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

[REBOL] Re: Problem with 'collect?

From: brett:codeconscious at: 17-Aug-2003 18:18

> Thanks for the hint from Gabriele, Brett.
> Which is right! :)
Very good. Strange thing though, I had incorporated a break into my collect function with a use context too. But when I use it with your Selects function it has an error, when I cut Selects down to the following it works ?! : Selects: func [ "Repeatedly finds a value in the series and returns the value or series after it." Series [series! port!] Values [block!] ] [ foreach Value Values collect [select series value] ] Mysteries, mysteries. Anyway, here's my lastest Collect for interest. collect: func [ {Collects block evaluations, use as body in For, Repeat, etc.} block [block!] "Block to evaluate." /initial result [series! datatype!] "Initialise the result." /only "Inserts into result using Only refinement." /local ] compose [ if not initial [result: block!] result: any [all [datatype? result make result 1000] result] use [break] [ break: does [system/words/break/return result] bind reduce [ 'head pick [insert insert/only] not only 'tail result to paren! block ] 'break ] ] Regards, Brett.