[REBOL] Re: COLLECTing results
From: AJMartin:orcon at: 25-Jul-2003 4:27
Brett wrote:
> /init result "Initialise the result series."
I'd use this instead:
/initial result [series!] "Initialise the result series."
as it fits better with existing Rebol refinements. See 'array.
> But I have got rid compose completely now :^)
:)
I'm still using 'compose/deep, but that's because I want 'collect to work as
much like my 'map as I can get it.
Collect: function [
{Collects the results of block evaluations.}
Block [block!] "The block to 'do."
/Only "Inserts the result as a series."
/Full "Don't ignore none! values."
/Initial Results [series!]
] [
Result
] [
Results: any [Results copy []]
compose/deep [
if not any [
unset? set/any 'Result do [(Block)]
(pick [[none? :Result] []] not Full)
] [
(pick [insert insert/only] not Only) tail Results :Result
]
Results
]
]
>> foreach c "abcde" collect/Initial [to integer! c] ""
== "979899100101"
Andrew J Martin
ICQ: 26227169 http://www.rebol.it/Valley/ http://Valley.150m.com/