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

'do vs 'reduce

 [1/2] 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
<<quoted lines omitted: 5>>
> 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

 [2/2] from: andreas:bolka:gmx at: 6-Jan-2004 22:08


Tuesday, January 6, 2004, 5:24:10 AM, Volker wrote:
> Am Montag 05 Januar 2004 17:59 schrieb Gregg Irwin: >> Hi Andreas,
<<quoted lines omitted: 12>>
> similar, but > 1) [do %file.r] <> [reducce %file.r]
that's what i meant with "non-block!" parameters. there are similar differences when you pass an url! or string! as parameter.
> 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.
same stuff here. not a block! is passed, and do behaves "specially" (apply/invoke style) when a function! is passed as first parameter. -- Best regards, Andreas

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted