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

I/O Funcers

blocks

Groups lines into blocks separated by empty lines.

TypeValue
InputArr<Str…>an array of consecutive lines
OutputArr<Arr<Str…>…>an array of arrays of lines, each representing a block

Each empty line in the input marks the end of a block. Blocks can be empty. The empty lines themselves are not included.

Examples

ProgramTypeValueError
["a", "b", "", "c", "d", "e", "f", ""] blocksArr<Arr<Str…>…>[["a", "b"], ["c", "d", "e", "f"]]
["a", ""] blocksArr<Arr<Str…>…>[["a"]]
["a"] blocksArr<Arr<Str…>…>[["a"]]
["", "a"] blocksArr<Arr<Str…>…>[[], ["a"]]
["a", "", "", "", "b"] blocksArr<Arr<Str…>…>[["a"], [], [], ["b"]]

err

Writes to STDERR.

TypeValue
Input<A Any>any value
OutputNullnull

Writes a string representation of the value to STDERR, followed by a line break.

Examples

ProgramTypeValueError

err

Writes to STDERR with a custom line end.

TypeValue
Input<A Any>any value
end (param #1)Strthe line end to use
OutputNullnull

Writes a string representation of the value to STDERR, followed by the specified line end.

Examples

ProgramTypeValueError

in

Reads from STDIN.

TypeValue
InputAnyany value (is ignored)
OutputReadera Reader representing STDIN

Examples

ProgramTypeValueError

json

Reads JSON values from a stream

TypeValue
InputReadera Reader
OutputArr<Any…>array of data structures as they appear in the stream

Examples

ProgramTypeValueError

lines

Reads a stream line-by-line

TypeValue
InputReadera Reader
OutputArr<Str…>an array of lines, without the line-break character

Examples

ProgramTypeValueError
"abc\nde\n\nf" reader linesArr<Str…>["abc", "de", "", "f"]

out

Writes to STDOUT.

TypeValue
Input<A Any>any value
OutputNullnull

Writes a string representation of the value to STDERR, followed by a line break.

Examples

ProgramTypeValueError

out

Writes to STDOUT with a custom line end.

TypeValue
Input<A Any>any value
end (param #1)Str
OutputNullnull

Writes a string representation of the value to STDOUT, followed by the specified line end.

Examples

ProgramTypeValueError

reader

Creates a Reader from a Str.

TypeValue
InputStra string
OutputReadera Reader from which the input can be read

Examples

ProgramTypeValueError