Bruijn supports a variant of John Tromp's monadic IO1.

Every program's main function has an additional abstraction that gets applied with a lazy list of input bytes. These bytes are encoded as the syntactic sugar encoding of binary numbers, which can be manipulated with std/Number/Binary.

You can use std/Monad to interact with the input monadically, or simply use std/List operations to work with the input as a normal list.

See data structures to learn more about lists and numbers.

If you want your main function to ignore the input, just add an additional (unbound) abstraction to your definition.


:import std/List .

# reverse the input list
main [<~>0]
$ printf "tacocat" | bruijn reverse.bruijn