yield
Operator
yield — emit values from expressions
Synopsis
[yield] <expr> [, <expr>...]
Description
The yield
operator produces output values by evaluating one or more
expressions on each input value and sending each result to the output
in left-to-right order. Each <expr>
may be any valid
expression.
The yield
keyword is optional since it is an
implied operator.
Examples
Hello, world
echo null | super -z -c 'yield "hello, world"' -
=>
"hello, world"
Yield evaluates each expression for every input value
echo 'null null null' | super -z -c 'yield 1,2' -
=>
1
2
1
2
1
2
Yield typically operates on its input
echo '1 2 3' | super -z -c 'yield this*2+1' -
=>
3
5
7
Yield is often used to transform records
echo '{a:1,b:2}{a:3,b:4}' | super -z -c 'yield [a,b],[b,a] |> collect(this)' -
=>
[[1,2],[2,1],[3,4],[4,3]]