Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: tailfunc

From: lmecir:mbox:vol:cz at: 21-Nov-2001 16:41

Hi Romano, <<Romano>> And why not an in-line function like: compose... do (func [] reduce [body]) <</Romano>> Your suggestion doesn't seem to work (?) ... <<Romano>> I have others little questions on your code: 1) A little thing: couldn't loop start to none? loop: none ... either loop [ loop: 1 ] [ until [ loop: none error? set/any 'result do (func [] reduce [body]) not loop ] loop: none <</Romano>> Loop surely can start with the None value. But even then for the function to work, we have to be able to detect three different states: 1) the first one is a fresh start, signaling that the loop must be started. 2) the second one is a situation, when the loop is "running" and a recursive call was detected. The loop must continue. 3) the third one is a situation, when the loop is "running" and a recursive call hasn't been detected. The loop must finish. If we want to use logic! values, we have to use two variables, e.g. like: loop: none ... either loop [ finish: none ] [ until [ finish: true error? set/any 'result exec (reduce [body]) finish ] loop: none ... <<Romano>> 2) You leave 'result global, why? --- Ciao Romano <</Romano>> Not only 'result, I left even the 'locals word global! It is a bug, I will repair it and include to %Highfun.r Thanks for your feedback. Cheers Ladislav