Sorry, there were small typos: Jakub Travnik wrote: > Sean Middleditch wrote: > > > > But those are the most fun languages to hack on. ^,^ > > yes :-) > >> Could you explain that better? I mean, in terms a moron like me can >> understand? ~,^ I'm curious about that feature. It sounds almost >> something like Scriptix uses, although the "variable" is not named or >> accessible from within the function (but it's there.) Do you just maen >> you have that, but the variable can be accessed and manipulated by the >> function before actually returning? > > > note: if you are interrested in this stuff, see examples inside jtpl source > > Ok, function is written in following way: > ---------------------- > { |param1, param2| > var variable1,variable2; -- note: variables are untyped unlike values > statement1; > statement2; > return(4); -- this is ordinary function/continuation call > } > ---------------------- > > > this function is anonymous it but can be assigned to variable i.e: > ---------------------- > var double; > double={|x| return(2*2);}; line above should be: double={|x| return(2*x);}; > writenum(double(3)); -- writes 6 > ---------------------- > > > Calling function and calling continuation is > same except that continuation have always only one argument. > > now program that uses continuations: > ---------------------- > var f,cont,counter; -- variable declaration > > f={ > cont=return; -- set cont to continuation of this function > -- return is like ordinary variable it can be read -- or written > return(100); -- return 100 > }; > > counter=0; -- set counter to zero > writenum(10+f()+1000);-- call b and write result of addition > > counter=counter+1; -- increase counter > > if(counter<4) -- loop limited number of times > cont(d); -- reuse continuation in cont, line above should be: cont(counter); -- reuse continuation in cont, -- this will restart computation inside -- addition/writenum above > end; > ---------------------- > source above will print numbers: 1110, 1011, 1012, 1013 > > > I hope this helps. > Happy hacking, Jakub Travnik jabber://jtra / jabber.com