[ prog / sol / mona ]

prog


How to learn Scheme's continuations

6 2021-09-18 23:55

http://wiki.c2.com/?CallWithCurrentContinuation

If you're a C programmer, you might find this explanation easier: in C, you can take a pointer to a function. In C, you also have a return statement. Suppose the return statement were a function (which never returned, of course). It would take a parameter of the same type as the return type of the function it was returning from. Now suppose you could take its address. You could store that address in a variable or pass it as a parameter, and allow functions to return on your behalf. That's what call/cc allows you to do. You can use it as a replacement for throw and catch, or you can set up coroutines with it

7


VIP:

do not edit these