5 ms·
I 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 featu
by jolmg 6y ago
I 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?
- gus_massa 6y agoI used to implement an equivalent of exit or return statement, like in this example. #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.
- a1369209993 6y agoYou could dispute "serious", but I've used it in a not!lisp for various control flow purposes. func a0 a1 = callcc \return: # ... callcc (again =) # ... x ?? return y again again
- kazinator 6y agoContinuations can be implicitly used. If you have a language that is compiled using transformation to CPS. Then continuations are everywhere under the hood.