Gabriele Santilli napsal(a):
> Hi Gregg,
>
> On Wednesday, May 10, 2006, 11:23:19 PM, you wrote:
>
> GI> How does it work?
>
> GI>     It takes a word and a block as arguments. Anytime the word appears
> GI>     as a set-word! in the block, the value assigned to it is
> GI>     "collected".
>     
> GI>     The above func would look like this:
>     
> GI>     fn: func [series] [
> GI>         collect v [foreach val series [v: val]
> GI>     ]
>
> Hmm, interesting. Alternative approach:
>
> use [out] [
>     out: []
>     collect: func [body /into output] [
>         output: any [:output make block! 16]
>         ; allows recursive usage
>         set [out output] reduce [output out]
>         do body
>         set [out output] reduce [output out]
>         output
>     ]
>     emit: func [value] [repend out :value :value]
> ]
>
> (If you make OUT global you also have a "global" collect)
>   
yes, an alternative (a bit less flexible, though). This inspires me to 
write a "political" note:

We have seen proposals to use 'WORD, 'GRAB, 'YIELD as a name of the 
first COLLECT argument. I suggest to use 'EMIT for this purpose to make 
CARL (and maybe other users) comfortable with it, what do you think?

-L

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to