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

[REBOL] Re: collect-in

From: lmecir:mbox:vol:cz at: 12-Dec-2003 17:14

Romano Paolo Tenca napsal(a):
>This is my idea of collect: > >collect-in: func [ > {Append block evaluations to a series, use as body in For, Repeat, etc.} > dest [block! hash! list! any-string!] "Series to append results" > block [block!] "Block to evaluate." > /only "Inserts into dest using the Only refinement." > /local main > ][ > change/only change change second main: func [res [any-type!]][ > none none none get/any 'res > get/any 'res > ] pick [insert insert/only] not only 'tail dest > reduce [:main to-paren block] >] > >;Usage: > >dest: make block! 100 >repeat n 10 collect-in dest [n * 100] > >The advantages: > is trasparent for break > works with empty block > inside the body you know where values are stored > is not slow > >I should like to submit it the view 1.3 project > >What do you think? > >--- >Ciao >Romano >
Does this behave well w.r.t. Return? -L