Compose - Function Summary
Summary:
Evaluates a block of expressions, only evaluating parens, and returns a block.
Usage:
compose value
Arguments:
value - Block to compose
Refinements:
/deep - Compose nested blocks
/only - Inserts a block value as a block
Description:
Builds a block of values from another block of values, but evaluates parenthesized expressions.
probe compose [result (1 + 2) ok]
[result 3 ok]
The elements of the input block are placed in the output block with the exception of parenthesized expressions, which have their final values placed in the output block.
probe compose [time: (now/time) date: (now/date)]
[time: 0:59:47 date: 9-Mar-2004]
If the result is itself a block, then the elements of that block are inserted into the output block (in the same way as INSERT).
colors: ["red" "green" "blue"]
probe compose [1 2 3 (colors)]
[1 2 3 "red" "green" "blue"]
To insert a block instead of its elements, place another block around it using the REDUCE function, or use the /ONLY refinement:
colors: ["red" "green" "blue"]
probe compose [1 2 3 (reduce [colors])]
[1 2 3 ["red" "green" "blue"]]
colors: ["red" "green" "blue"]
probe compose/only [1 2 3 (colors)]
[1 2 3 ["red" "green" "blue"]]
To evaluate sub-block parens, use the /DEEP refinement:
probe compose/deep [1 [2 [(1 + 2) 4]]]
[1 [2 [3 4]]]
Related:
build-tag - Generates a tag from a composed block. insert - Inserts a value into a series and returns the series after the insert. reduce - Evaluates an expression or block expressions and returns the result. rejoin - Reduces and joins a block of values.