FAQ Database Discussion Community

Image freeze when a continuation is called

I'm trying to test the continuation facility in Pharo, with this code(in the playground): | cont f | f:=[ |i| i:=0. Continuation currentDo: [ :cc | cont:=cc ]. i:=i+1. ]. f value. "1" cont. "a Continuation" However, as soon as I call the continuation saved in cont(replacing cont. by cont...

How to check recursive call results in CPS codes

So I'm working on a function to find some valid arithmetic operations to a target number from an int list. It's not allowed to use throw/callac. Only add and mul are valid arithmetic operations here and they are left associative. datatype operation = ADD | MULT (* find_op: int ->...

Comments in continuation lines

Say I have a multiline command: if 2>1 \ and 3>2: print True In an if block, I can add a comment next to one of the conditions by using parentheses to wrap the lines: if (2>1 #my comment and 3>2): print True And, in fact, it is aligned with...