forked from rebol/rebol
-
Notifications
You must be signed in to change notification settings - Fork 2
Collect
angerangel edited this page Mar 15, 2013
·
1 revision
COLLECT body /into output
Evaluates a block, storing values via KEEP function, and returns block of collected values.
COLLECT is a function value.
- body -- Block to evaluate (block!)
-
/into -- Insert into a buffer instead (returns position after insert)
- output -- The buffer series (modified) (series!)
#SOURCE
collect: make function! [ [
{Evaluates a block, storing values via KEEP function, and returns block of collected values.}
body [block!] "Block to evaluate"
/into {Insert into a buffer instead (returns position after insert)}
output [series!] "The buffer series (modified)"
][
unless output [output: make block! 16]
do func [keep] body func [value [any-type!] /only] [
output: apply :insert [output :value none none only]
:value
]
either into [output] [head output]
] ]