Re:Continuations by example: Exceptions, time-traveling sear...
by verytrivial on Thursday July 16, 2020 @02:22PM
(#23862040)
I always start Matt Might articles thinking "Okay, THIS is the one I'm going to understand all the way to the very end without unlearning what I just read, else I die," and alas, I have again died.
[ Parent
| on HN ]
Re:Continuations by example: Exceptions, time-traveling sear...
by azeirah on Thursday July 16, 2020 @05:24PM
(#23863985)
I'm having an ADHD night and I had the same thought, except I haven't died yet. Felt like giving up three times already, but I did have a click moment after playing around with a scheme repl for a couple of minutes. I understand the first example of call/cc now!
(display
(call/cc (lambda (cc)
(display "I got here.\n")
(cc "This string was passed to the continuation.\n")
(display "But not here.\n"))))
Edit: Tried playing around with mit-scheme, but it doesn't work with the ctrl-v'ing the examples. Chezscheme does work.
Re:Continuations by example: Exceptions, time-traveling sear...
by hencq on Thursday July 16, 2020 @06:13PM
(#23864436)
It seems that MIT-Scheme needs the cc function to be a function of 1 argument (the return value for the continuation)[0]
Changing it to the following should work:
(let ((start #f))
(if (not start)
(call/cc (lambda (cc)
(set! start cc))))
(display "Going to invoke (start)\n")
(start #f))
[0] https://www.gnu.org/software/mit-scheme/documentation/stable...
Re:Continuations by example: Exceptions, time-traveling sear...
by DonaldPShimoda on Thursday July 16, 2020 @07:50PM
(#23865250)
For what it's worth, almost any time Matt writes about Scheme he's likely using Racket so it'd be worth trying that for his posts!
Re:Continuations by example: Exceptions, time-traveling sear...
by vincnetas on Thursday July 16, 2020 @02:32PM
(#23862170)
Me to. Level failed, but then i found this cheat code from apache and at lest i now understand basics.
Re:Continuations by example: Exceptions, time-traveling sear...
by offbynull on Thursday July 16, 2020 @03:02PM
(#23862555)
AFAIK Javaflow's been inactive for over a decade. Newer implementations for the same concept include https://github.com/offbynull/coroutines and https://github.com/vsilaev/tascalate-javaflow/.
Full disclosure: I'm the one who built / owns the first project.
Re:Continuations by example: Exceptions, time-traveling sear...
by joel_dice on Thursday July 16, 2020 @05:49PM
(#23864199)
On the topic of inactive continuation implementations for Java: I implemented native support for both delimited (shift/reset) and non-delimited (call/cc) continuations in the Avian JVM. See https://github.com/ReadyTalk/avian/blob/master/test/extra/Co... for some mind-bending examples.