How does the yin-yang puzzle work?

Understanding Scheme I think at least half of the problem with understanding this puzzle is the Scheme syntax, which most are not familiar with. First of all, I personally find the call/cc x to be harder to comprehend than the equivalent alternative, x get/cc. It still calls x, passing it the current continuation, but somehow … Read more

I just don’t get continuations!

Imagine if every single line in your program was a separate function. Each accepts, as a parameter, the next line/function to execute. Using this model, you can “pause” execution at any line and continue it later. You can also do inventive things like temporarily hop up the execution stack to retrieve a value, or save … Read more

What’s the difference between a continuation and a callback?

I believe that continuations are a special case of callbacks. A function may callback any number of functions, any number of times. For example: var array = [1, 2, 3]; forEach(array, function (element, array, index) { array[index] = 2 * element; }); console.log(array); function forEach(array, callback) { var length = array.length; for (var i = … Read more

tech