So, the setup is a group of three coroutines, with the execution threaded through them. The original invocation prints 1 and creates the second one. The second one prints 1 and switches back to the first. The first prints 2 and creates a third invocation, which prints 1 and jumps back to the first. The first prints 3 and completes. This is how "11213" is produced.
this made my day :) I just had to swap two statements in the implementation of 'let for my scheme to comply with the Mondo Bizarro puzzle.
now I wonder how many similar traps are still open in my code... looks like I can expect 'call/cc to to behave badly again some time, since I don't see a way to get a systematic overview of these subtle issues and fix them all.
what I can do is implement a call/cc stress test for my scheme. if people have little nasty piece of scheme code to submit, I would gladly include them in the test suite.
for those interested, the scheme for Squeak is available here: http://www.zogotounga.net/comp/squeak/lispkit.htm
and the current tests are the #testCallCC serie in ULispWithLibTest. obviously I need more or them.
regards,
Stef