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

[REBOL] Re: Threading continued

From: joel:neely:fedex at: 29-Jan-2004 17:09

Hi, Maarten, Maarten Koopmans wrote:
> ... it responds to a 'rest word, giving you the restof the > block to be evaluated and the value of the last evaluated expression. > > So: eval [ 10 + 10 join "a" "b" rest 20 print "howdy" ] > >> [ "ab" [ 20 print "howdy"]] > > Note that the second item (the rest of the code) is the position in the > original code, so a ' head on that gives you the original code back. >
Sort of like iterating DO/NEXT with an additional check for REST ?
> Question: is this a thing any of you want despite the performance hit of > 400% ? >
I pondered doing something with DO/NEXT a while back, but gave up in frustration (I hope you're smarter and/or more patient than I ;-) as I want to be able to write expressions/functions more sophisticated than a single block, but still have interruptability. For example: eval [ foreach line read/lines %somefile [ print line rest ] ] Or interruptableFunction: func [aLine [string!]] [ print aLine doSomethingInteresting aLine rest ] eval [ foreach line read/lines %someOtherFile [ interruptableFunction line ] ] You said "takes a block" so I inferred that things such as the above (nested blocks, including function evaluation) are currently out of reach. Am I too pessimistic? If I have to do all the work of managing e.g. loops and other "control structures", including functions, I think I'd probably want to just go ahead and evert the code into a task object (per the article on REBOLforces) with a STEP method that does some meaningful (but not over long) piece of work and then saves state and returns control. -jn- -- ---------------------------------------------------------------------- Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446 Enron Accountingg in a Nutshell: 1c=$0.01=($0.10)**2=(10c)**2=100c=$1