summaryrefslogtreecommitdiffstats
path: root/srfi/srfi-126-impl.scm
diff options
context:
space:
mode:
authorGravatar John Cowan 2022-07-14 19:26:33 -0400
committerGravatar John Cowan 2022-07-14 19:26:33 -0400
commit85689befa282c43e97da86943ad25b95eba130d4 (patch)
tree7e7104fb5dade35484d104d637d5d552c830cc6d /srfi/srfi-126-impl.scm
parentreturn of alists (diff)
parentMerge pull request #4 from arvyy/master (diff)
Merge branch 'master' of https://github.com/johnwcowan/srfi-225
Diffstat (limited to 'srfi/srfi-126-impl.scm')
-rw-r--r--srfi/srfi-126-impl.scm32
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))