on bc0f661 help sign in
urbit.org/docs/dev/nock.md
52 lines 1.1 kB history raw
1---
2logo: black
3sort: 1
4title: Nock
5---
7# Nock
9Nock is a homoiconic combinator algebra, not much fancier than SKI
10combinators. We'll have some tutorials soon. The spec:
12```
13A noun is an atom or a cell.
14An atom is a natural number.
15A cell is an ordered pair of nouns.
17nock(a) *a
18[a b c] [a [b c]]
20?[a b] 0
21?a 1
22+[a b] +[a b]
23+a 1 + a
24=[a a] 0
25=[a b] 1
26=a =a
28/[1 a] a
29/[2 a b] a
30/[3 a b] b
31/[(a + a) b] /[2 /[a b]]
32/[(a + a + 1) b] /[3 /[a b]]
33/a /a
35*[a [b c] d] [*[a b c] *[a d]]
37*[a 0 b] /[b a]
38*[a 1 b] b
39*[a 2 b c] *[*[a b] *[a c]]
40*[a 3 b] ?*[a b]
41*[a 4 b] +*[a b]
42*[a 5 b] =*[a b]
44*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
45*[a 7 b c] *[a 2 b 1 c]
46*[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
47*[a 9 b c] *[a 7 c 2 [0 1] 0 b]
48*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
49*[a 10 b c] *[a c]
51*a *a
52```