What is Nock ISA?
The Nock Instruction Set Architecture
The Nock instruction set architecture is a minimalist computational framework. It balances formal Turing completeness with just enough tooling to carry out operations more efficiently than a pure lambda calculus or SKI combinator would allow. (It also has a convenient "escape hatch" for accelerated code evaluation.)
Like a byte code or an assembly language, the Nock ISA represents operations very directly, and typically developers write programs in a higher-level language that compiles to Nock ISA (Hoon or Jock). This way, they can get the formal provability of Nock ISA and its execution environment (Nockchain and NockApp) without writing the execution layer directly.
Nock 4K
A noun is an atom or a cell. An atom is a natural number. A cell is an ordered pair of nouns.
Reduce by the first matching pattern; variables match any noun.
nock(a) *a
[a b c] [a [b c]]
?[a b] 0
?a 1
+[a b] +[a b]
+a 1 + a
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
/a /a
#[1 a b] a
#[(a + a) b c] #[a [b /[(a + a + 1) c]] c]
#[(a + a + 1) b c] #[a [/[(a + a) c] b] c]
#a #a
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] +*[a b]
*[a 5 b c] =[*[a b] *[a c]]
*[a 6 b c d] *[a *[[c d] 0 *[[2 3] 0 *[a 4 4 b]]]]
*[a 7 b c] *[*[a b] c]
*[a 8 b c] *[[*[a b] a] c]
*[a 9 b c] *[*[a c] 2 [0 1] 0 b]
*[a 10 [b c] d] #[b *[a c] *[a d]]
*[a 11 [b c] d] *[[*[a c] *[a d]] 0 3]
*[a 11 b c] *[a c]
*a *a
The Nock ISA paradigm is:
Turing-complete. Nock ISA is capable of general-purpose computing.
Functional-as-in-language. Nock ISA expressions result in values without formal side effects, but results like I/O and network calls can be produced via runtime hints.
Untyped. All data are either simply natural numbers or pairs (nesting as binary trees).
Homoiconic. Code and data are written using the same basic values.
Solid-state. Any evaluation results in a deterministic value and an updated state.
Tiny. Twelve opcodes supply the full specification.
The first part of this video features Zorp mathematician Brian Klatt explaining the basics of the Nock ISA:
This video by Zorp engineer N. E. Davis (then at Urbit Foundation) explains how the Nock ISA works in more detail:
Last updated