Data Structures
Cells/Tuples
The base type in Nock is the noun, which is either an atom (bare nonnegative integer) or a cell (pair). Jock likewise defines the basic tuple as a rightward-branching Nock-style cell, but uses ()
“pal”/“par” to mark the container contents.
Lists
A list is a null-terminated tuple marked by []
“sel”/“ser”. The null is supplied automatically by Jock.
Sets
Sets are collections of unique elements marked by {}
“kel”/“ker”. They are internally ordered for fast access by the compiler.
(Maps or dictionaries are planned for a future release.)
Distinguishing from Code Blocks
Because {}
“sel”/“ser” denote both code blocks and sets, you must be careful to structure your expression correctly to achieve the result you intend. This first program results in either 72 or 17 as a number.
Contrast that result, which is a bare atom, with the result of the following:
This results in a Set(@)
or set of atoms with a single member, 72.
Last updated