REBOL 3 Docs | Guide | Concepts | Functions | Datatypes | Errors |
TOC < Back Next > | Updated: 3-Aug-2010 Edit History |
Evaluates a block, storing values via KEEP function, and returns block of collected values.
Arguments:
body [block!] - Block to evaluate
Refinements:
/into - Insert into a buffer instead (returns position after insert)
output [series!] - The buffer series (modified)
Using the internal keep function, will collect values spread around a block to be stored in another block and returned:
collect [keep 1 2 3 keep 4]
[1 4]
Can also be used with the parse function:
collect [
parse [a b c d e] [
any ['c | 'e | set w word! (keep w)]
]
]
[a b d]
Blocks are collected and appended to the output as a series of values:
collect [keep 1 keep [2 3]]
[1 2 3]
The keep function has a refinement /only to append blocks as blocks to the output:
collect [keep 1 keep/only [2 3]]
[1 [2 3]]
TOC < Back Next > | REBOL.com - WIP Wiki | Feedback Admin |