You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just found interesting case of continuations that break in Biwascheme:
(call/cc (lambda (return)
(let ((n 5)
(result (list))
(k #f))
(set! result (append result (list (call/cc (lambda (return)
(set! k return)
"Hello")))))
(when #t
(if (zero? n)
(return result))
(set! n (- n 1))
(k (string-append "Hello <" (number->string n) ">"))))))
This should evaluate to ("Hello <0>") because the reference to result is kept in continuation, and the env is restored on each iteration and it gets reset to an empty list.
I've tested this in Guile, Gamibt and Chicken they all return a list with the last element. BiwaScheme return list of all elements.
The text was updated successfully, but these errors were encountered:
jcubic
changed the title
Mutation of environments while capturing continuations
Mutation of environments while capturing continuations with call/cc
Jan 3, 2022
Just found interesting case of continuations that break in Biwascheme:
This should evaluate to
("Hello <0>")
because the reference to result is kept in continuation, and the env is restored on each iteration and it gets reset to an empty list.I've tested this in Guile, Gamibt and Chicken they all return a list with the last element. BiwaScheme return list of all elements.
The text was updated successfully, but these errors were encountered: