4 ms·
It is right there in the "Escaping continuations" section. Escaping early means you can use it to write simple things like "drop" and "take", and lazy evaluatio
by i_feel_great 8y ago
It is right there in the "Escaping continuations" section. Escaping early means you can use it to write simple things like "drop" and "take", and lazy evaluation. I believe, though I do not know for sure, that this is how lazy evaluation is implemented in lisps, including Clojure.
Also it allows you to write a threading implementation like coroutines in another section below.
Generally it does this: you have a process, say that does A, B, C, D and E. You let it run and save it at, say "C". The continuation is the rest of the process, "D" and "E". So now you go and do something else, say a process from J to U. Somewhere in there, you can whip out your continuation and it does "D" and "E". You are simply bookmarking something to do later because you gotta go do something else.
In coroutines, you run one, stop and save the continuation and switch to another, run, stop, save and switch, and so on and so on, and then jump back and resume the original etc.
- thelastidiot 8y agoFor the fact that you have to explain in a paragraph or two what are continuation, I don't think the material in the book is doing a good job.