Hi Ladislav,

LM> hope you don't mind me asking if you noticed the difference in the
LM> behaviour of the proposed solutions w.r.t. this test?

I don't mind at all! As usual, you have me scratching my head about
how you come up with your solutions, and how they work (like the first
two lines in this one). ;)

Now, I just have to decide if I should fix mine or adopt yours. :)

I'm sure I can adapt to the function syntax, if that's what Carl
eventually chooses, or what we come up with as a "standard" COLLECT
function, even if it doesn't get into R3.

    collect: func [
        [throw]
        {Collects block evaluations.}
        'emit "Yield-function name"
        block [any-block!] "Block to evaluate"
        /into dest [series!] "Where to append results"
        /only "Insert series results as series"
    ] [
        emit: reduce [emit]
        emit: first use emit reduce [emit]
        use [dst] copy/deep [

; Why "make block! []" rather than "copy []"?
            dst: any [:dest make block! []]

; Do we want to refactor the duplicate func body into something like
; this:
            set emit func [value [any-type!]] head insert
                [tail :dst get/any 'value   get/any 'value]
                pick [insert insert/only] not only
; or this:
            set emit func [value [any-type!]] append copy either only
                [[insert/only]] [[insert]]
                [tail :dst get/any 'value   get/any 'value]
; They aren't as clear to the casual reader, like our original ROUND
; func is not as clear as your improved one that uses CASE.

            do bind/copy block emit
            head :dst
        ]
    ]


Does anyone else have any comments, WRT returning HEAD or not,
Ladislav's note about a SET-like syntax, or Gabriele's version?


-- Gregg                         

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

Reply via email to