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

[REBOL] Re: 'do vs 'reduce

From: nitsch-lists::netcologne::de at: 6-Jan-2004 5:24

Am Montag 05 Januar 2004 17:59 schrieb Gregg Irwin:
> Hi Andreas, > > AB> i was wondering if, letting refinements and non-block! parameters > AB> aside, 'do is really just a "last reduce", in other words, if (a > AB> simplified) do could be precisely expressed as: > > AB> do: func [ bl [block!] ] [ last reduce bl ] > > Well, both cause evaluation. If LOAD were used (thinking about binding > issues), and having not done any tests, my feeling is that you're > probably right. Knowing how Carl likes to build things, I can't > imagine he'd want two separate evaluators in REBOL. :) >
similar, but 1) [do %file.r] <> [reducce %file.r] 2) 'do can give arguments to expressions. the only function with a dynamic number of arguments: !>> reduce func[a][a * a] 5 == 5 ; reduce-result is thrown away !>> do func[a][a * a] 5 == 25 ; 5 is past to func by do. 'do fetches actually 2 arguments in this case. !>> do pick a-block-with-funcs 5 ; would work too 3) does not create a block, should be faster.
> -- Gregg
-Volker