Dr. J. J. "One Eyed CrackerJack" Harbaugh 



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Ladislav Mecir
Sent: Wednesday, November 26, 2003 3:56 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: COLLECTing results



Hi Brett, Andrew, Romano et al.,

>---latest version
>
>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."
>] [
>    if not initial [result: block!]
>    result: any [all [datatype? result make result 1000] result]
>    reduce ['head pick [insert insert/only] not only 'tail result 'do

>:block] ]
>  
>

I am sorry I missed your contribution on the subject somehow. I like
it. 
My two cents changing the behaviour of the function in cases like:

    foreach head heads [...]
    foreach insert inserts [...]
    foreach tail tails [...]
    foreach do does [...]

use [insert-only] [
    insert-only: func [series value] [insert/only series value]
    collect: func [
        {Collects block evaluations, use as body in For, Repeat, etc.}
        block [block!] "Block to evaluate."
        /initial result [series!] "Initialise the result."
        /only "Inserts into result using the Only refinement."
    ] [
        result: any [make result result make block! 10]
        reduce [
            :head pick reduce [
                :insert :insert-only
            ] not only :tail result :do block
        ]
    ]
]

-L

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to