Reference
Built-in Nodes

Built-in Nodes

n-ary Operators (for n ≥ 1)

The n-ary operators provided are: +, *, ++, &&, ||.

  • ++ concatenates arrays or strings.
  • Output is produced only after all inputs have received a value.
  • Can also be written as infix operators (then they become binary operators).

Binary Operators

The binary operators provided are: -, /, %, ==, !=, >=, <=, >, <.

  • Output is produced only after all inputs have received a value.
  • Can be used as infix operators.

Other Nodes

not

  • Description: Outputs the boolean negation of the input.
  • Input: arg0 (boolean)
  • Output: result (boolean)

output

  • Description: Displays data on the screen. Program pauses until user presses Enter without typing anything. If input is provided, the program terminates.
  • Input: arg0 (data to display)
  • Output: none

trace

  • Description: Similar to output, but passes data downstream after user resumes (side-effecting identity).
  • Input: arg0 (data to display)
  • Output: result (same data as arg0)

input

  • Description: Waits for user input; passes it downstream as a string.
  • Input: request (flag to request user input)
  • Output: result (user input as string)

Example: Adding 1 to user input repeatedly:

flow ver 0.2.0
> @a'1 -> input -> int -> + 1 -> trace -> @a
Input: 1
2
Input: 2
3
Input: 4
5.
terminated

merge

  • Description: Passes upstream data to a single downstream node; starvation-free.
  • Input: arg0, arg1, ..., arg(n-1)
  • Output: result

copy

  • Description: Copies upstream data to all downstream nodes (all outputs must be ready).
  • Input: arg0
  • Output: copy0, copy1, ..., copy(n-1)

if

  • Description: Branches based on condition. If True, flows to then; else, to else. If value is provided, its data is passed downstream. Waits until both condition and value are ready if value is used.
  • Input: condition, value (optional)
  • Output: then, else (optional)

id

  • Description: Identity function.
  • Input: arg0
  • Output: result

exit

  • Description: Terminates program when data flows in.
  • Input: arg0
  • Output: none

map

  • Description: Takes an array, passes elements downstream one by one. Sends an EOF-like marker after last element.
  • Input: arg0 (array)
  • Output: result (element)

unmap

  • Description: Receives elements and outputs them as an array when EOF-like marker is received.
  • Input: arg0 (elements + EOF)
  • Output: result (array)

pair

  • Description: Forms a pair from two inputs; waits for both inputs.
  • Input: fst, snd
  • Output: result (pair)

unpair

  • Description: Takes a pair and outputs its first and second elements.
  • Input: arg0 (pair)
  • Output: fst, snd

int

  • Description: Converts upstream data to a number. Strings are parsed. Booleans: True → 1, False → 0. Other values cause error.
  • Input: arg0 (value)
  • Output: result (number)

str

  • Description: Converts upstream data to a string.
  • Input: arg0 (value)
  • Output: result (string)

bool

  • Description: Converts upstream data to boolean. Only "", 0, False, []False; all else → True.
  • Input: arg0 (value)
  • Output: result (boolean)