4 ms·
Can anyone point me in the direction some call with continuation and stack and heap explainer? It would be great if it was brief and visual but I'm willing to r
by gtoast 10y ago
Can anyone point me in the direction some call with continuation and stack and heap explainer? It would be great if it was brief and visual but I'm willing to read up. I just want to make sure that an explanation of call/cc is forthcoming.
- qwertyuiop924 10y agoWhat exactly about them do you want explained? I'll do my best to do it, or give a link, but I'm not sure if you want a general explanation of all three, or an explanation of the connection beteen them.
- justinethier 10y agoHere is a basic introduction to the stack and heap, with examples in C: http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html This might help with continuations: https://en.wikipedia.org/wiki/Continuation https://en.wikipedia.org/wiki/Continuation Here is a really simple example of simulating a C return using call/cc: (display (call/cc (lambda (return) (display "hello ") (return "world") (display "never reached"))))
- qwertyuiop924 10y agoFor continuations, I would actually recomend "LAMBDA: The Ultimate Imperative" (http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-353.pdf http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-...). It's not exactly light reading, but it gives the best explanation of continuations that I've seen. If you just want the simple explanation: A continuation is a copy of the return stack at the instant it was captured. When a continuation is invoked, that copy replaces the stack.
- gtoast 10y agoThis is perfect! Thank you!
- gtoast 10y agoThanks!