News for hackers. Stuff that matters.
Re:Adventures of an imperative programmer in the land of fp by silentbicycle on Friday August 27, 2010 @04:50PM (#1640232)
Indeed. For some reason, closures never tripped me up, but continuations took a while to wrap my head around. (I think because I tried to learn continuation-passing-style first. While also learning OCaml.)

Since you know C, it might help to think of continuations in terms of setjmp/longjmp, but with multiple, persistent stacks. (Same with coroutines, but coroutines and continuations have a lot of overlap.)

Re:Adventures of an imperative programmer in the land of fp by jacquesm on Friday August 27, 2010 @05:46PM (#1640392)
> in terms of setjmp/longjmp, but with multiple, persistent stacks.

That's exactly the thing I used to help me visualize it :) Funny you came up with the exact same model.

Setjmp and longjmp are by the way probably two of the most abused calls in the C runtime package. But when you need them, you need them badly.