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

[REBOL] Re: COLLECTing results

From: g:santilli:tiscalinet:it at: 24-Jul-2003 9:57

Hi Brett, On Thursday, July 24, 2003, 7:44:19 AM, you wrote: BH> collect: func [ BH> {Collects block evaluations, use with For, Repeat, etc.} BH> block [block!] BH> /init result "Initialise the result series." BH> /only "Inserts into result using Only refinement." BH> ] [ BH> if empty? block [return block] BH> compose [ BH> result: any [result make block! 100] BH> (pick [insert/only insert] found? only) tail result (block) BH> result BH> ] BH> ] Small note: you should bind your RESULT word to a fresh context (USE, etc.), otherwise you'll be relying on COLLECT's context not being modified while the body block is getting evaluated. Anyway, this is a great idea! Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/