Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operator

fork — copy values to parallel pipeline branches

Synopsis

fork
  ( <branch> )
  ( <branch> )
  ...

Description

The fork operator copies each input value to multiple, parallel branches of the pipeline.

The output of a fork consists of multiple branches that must be merged. If the downstream operator expects a single input, then the output branches are combined without preserving order. Order may be reestablished by applying a sort at the merge point.

Examples


Copy input to two pipeline branches and merge

# spq
fork
  ( pass )
  ( pass )
| sort this
# input
1
2
# expected output
1
1
2
2