Earlier quoted context omitted.
Me to. Level failed, but then i found this cheat code from apache and at lest i now understand basics. http://commons.apache.org/sandbox/commons-javaflow/
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.
Continuations by example: Exceptions, time-traveling search, threads, and more
11–19 of 19 posts
Re: Continuations by example: Exceptions, time-traveling search, threads, and more
#12Re: Continuations by example: Exceptions, time-traveling search, threads, and more
#13Has anyone used continuations in a serious/non-academic way?
Re: Continuations by example: Exceptions, time-traveling search, threads, and more
#14I 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.
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 play…
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 search, threads, and more
#15I think I've found a good use for continuations in a parser combinator library I'm writing, though I haven't gotten around to working on the corresponding feature yet. Has anyone used continuations in a serious/non-academic way?
#lang racket
; implement sqrt in a very inefficient way
(let/ec exit
(for ([i 10])
(when (= (* i i) 49)
(exit i)))
"not found :(")
;==> 7
There are more idiomatic and easy ways to write this, but when you have to many nested and not nested for's, sometimes it is useful to have a magical exit-everything-now.Re: Continuations by example: Exceptions, time-traveling search, threads, and more
#16I 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.
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 play…
Re: Continuations by example: Exceptions, time-traveling search, threads, and more
#17I think I've found a good use for continuations in a parser combinator library I'm writing, though I haven't gotten around to working on the corresponding feature yet. Has anyone used continuations in a serious/non-academic way?
func a0 a1 = callcc \return:
# ...
callcc (again =)
# ...
x ?? return y
again againRe: Continuations by example: Exceptions, time-traveling search, threads, and more
#18I think I've found a good use for continuations in a parser combinator library I'm writing, though I haven't gotten around to working on the corresponding feature yet. Has anyone used continuations in a serious/non-academic way?