diff options
| author | 2022-06-29 08:23:48 -0400 | |
|---|---|---|
| committer | 2022-06-29 08:23:48 -0400 | |
| commit | d00d1b8d8f2ee3e19b60357d0d751e818e41745e (patch) | |
| tree | 812bd300d7b9ece3f690365fb6ce76cabf5040dc /srfi/srfi-126-impl.scm | |
| parent | editorial (diff) | |
| parent | update implementation (diff) | |
Merge pull request #4 from arvyy/master
update implementation
Diffstat (limited to 'srfi/srfi-126-impl.scm')
| -rw-r--r-- | srfi/srfi-126-impl.scm | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/srfi/srfi-126-impl.scm b/srfi/srfi-126-impl.scm index b4c9845..4bdb53d 100644 --- a/srfi/srfi-126-impl.scm +++ b/srfi/srfi-126-impl.scm @@ -23,50 +23,60 @@ #t (begin (t126-hashtable-set! table (car obj) (cadr obj)) - (loop (cddr obj)))))) + (loop (cddr obj))))) + table) (define (t126-hashtable-delete-all* dto table keys) (for-each (lambda (key) (t126-hashtable-delete! table key)) - keys)) + keys) + table) (define (t126-hashtable-intern* dto table key default) - (t126-hashtable-intern! table key default)) + (values table (t126-hashtable-intern! table key default))) (define (t126-hashtable-update/default* dto table key updater default) - (t126-hashtable-update! table key updater default)) + (t126-hashtable-update! table key updater default) + table) (define (t126-hashtable-pop* dto table) (if (t126-hashtable-empty? table) (error "popped empty dictionary") - (t126-hashtable-pop! table))) + (call-with-values (lambda () (t126-hashtable-pop! table)) + (lambda (key value) (values table key value))))) (define (t126-hashtable-update-all* dto proc table) - (t126-hashtable-update-all! table proc)) + (t126-hashtable-update-all! table proc) + table) (define (t126-hashtable-filter* dto proc table) (t126-hashtable-prune! table (lambda (key value) - (not (proc key value))))) + (not (proc key value)))) + table) (define (t126-hashtable-remove* dto proc table) - (t126-hashtable-prune! table proc)) + (t126-hashtable-prune! table proc) + table) (define (t126-hashtable-find-update* dto table key fail success) (define (handle-success value) (define (update new-key new-value) (unless (eq? new-key key) (t126-hashtable-delete! table key)) - (t126-hashtable-set! table new-key new-value)) + (t126-hashtable-set! table new-key new-value) + table) (define (remove) - (t126-hashtable-delete! table key)) + (t126-hashtable-delete! table key) + table) (success key value update remove)) (define (handle-fail) (define (ignore) table) (define (insert value) - (t126-hashtable-set! table key value)) + (t126-hashtable-set! table key value) + table) (fail insert ignore)) (define default (cons #f #f)) |
