summaryrefslogtreecommitdiffstats
path: root/srfi/srfi-146-impl.scm
diff options
context:
space:
mode:
authorGravatar John Cowan 2021-11-11 16:48:07 -0500
committerGravatar John Cowan 2021-11-11 16:48:07 -0500
commit1ff574608d023a5c98f7b30f9025c7aa7e4b53f7 (patch)
tree2084df6c76ed4c0b7517cd299d70dd96bca55238 /srfi/srfi-146-impl.scm
parentMerge remote-tracking branch 'arvyy/master' (diff)
parentcomments (diff)
Merge remote-tracking branch 'arvyy/master'
Diffstat (limited to 'srfi/srfi-146-impl.scm')
-rw-r--r--srfi/srfi-146-impl.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/srfi/srfi-146-impl.scm b/srfi/srfi-146-impl.scm
index 49b4737..a5d3aa6 100644
--- a/srfi/srfi-146-impl.scm
+++ b/srfi/srfi-146-impl.scm
@@ -18,8 +18,11 @@
;; and force it into tail call
(call/cc (lambda (k2)
(define result
- (failure (lambda (value) (k2 (insert value #f)))
- (lambda () (k2 (ignore #f)))))
+ ;; calls to insert / ignore / update / remove
+ ;; can return unspecified amount of values,
+ ;; hence call-with-values approach
+ (failure (lambda (value) (call-with-values (lambda () (insert value #f)) k2))
+ (lambda () (call-with-values (lambda () (ignore #f)) k2))))
;; neither insert nor ignore called -- return result to top level escape
(k result))))
(lambda (key value update remove)
@@ -28,8 +31,8 @@
(success
key
value
- (lambda (new-key new-value) (k2 (update new-key new-value #f)))
- (lambda () (k2 (remove #f)))))
+ (lambda (new-key new-value) (call-with-values (lambda () (update new-key new-value #f)) k2))
+ (lambda () (call-with-values (lambda () (remove #f)) k2))))
(k result))))))
new-dict)))