Gregg Irwin napsal(a):
> Thanks guys!
>
> Ladislav, you amaze me. Very cool.
>
> I have a version that uses a func as well, though I called it GRAB by
> default; YIELD seems to me a more general term, it works well in the
> context of passing in a function that could do anything, not just
> collect a value.
>
> I also like the idea of a general MAP function.
>
> Any other suggestions or comments folks? set-word or func preference?
> Is COLLECT a good name?
>
> -- Gregg
>
>
'grab is OK for me. One variant I am always taking into account is:
collect-var: func [
[throw]
{Collects block evaluations.}
grab [word!] "grab-function name"
block [any-block!] "Block to evaluate"
/into dest [series!] "Where to append results"
/only "Insert series results as series"
] [...]
because the native SET function uses this calling convention too. The
advantage is, that this calling convention is referentially transparent,
i.e. it allows expression result as its 'grab argument value.
Request: please add this test to your test suite (it tests different
property than the tests you are using):
; test
collect x [
probe collect y [
foreach i [1 2] [
x: i
y: negate i
]
]
]
-L
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.