Nock

From Esolang
Jump to navigation Jump to search

Nock is a low level typeless esoteric functional programming language. It is created to host a slightly higher level typeless functional esoteric language called Hoon, which compiles to Nock.

Specification

 1  ::    A noun is an atom or a cell.
 2  ::    An atom is a natural number.
 3  ::    A cell is an ordered pair of nouns.
 4  ::
 5  ::    nock(a)          *a
 6  ::    [a b c]          [a [b c]]
 7  ::
 8  ::    ?[a b]           0
 9  ::    ?a               1
 10 ::    +[a b]           +[a b]
 11 ::    +a               1 + a
 12 ::    =[a a]           0
 13 ::    =[a b]           1
 14 ::    =a               =a
 15 ::
 16 ::    /[1 a]           a
 17 ::    /[2 a b]         a
 18 ::    /[3 a b]         b
 19 ::    /[(a + a) b]     /[2 /[a b]]
 20 ::    /[(a + a + 1) b] /[3 /[a b]]
 21 ::    /a               /a
 22 ::
 23 ::    *[a [b c] d]     [*[a b c] *[a d]]
 24 ::
 25 ::    *[a 0 b]         /[b a]
 26 ::    *[a 1 b]         b
 27 ::    *[a 2 b c]       *[*[a b] *[a c]]
 28 ::    *[a 3 b]         ?*[a b]
 29 ::    *[a 4 b]         +*[a b]
 30 ::    *[a 5 b]         =*[a b]
 31 ::
 32 ::    *[a 6 b c d]     *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
 33 ::    *[a 7 b c]       *[a 2 b 1 c]
 34 ::    *[a 8 b c]       *[a 7 [[7 [0 1] b] 0 1] c]
 35 ::    *[a 9 b c]       *[a 7 c 2 [0 1] 0 b]
 36 ::    *[a 10 [b c] d]  *[a 8 c 7 [0 3] d]
 37 ::    *[a 10 b c]      *[a c]
 38 ::
 39 ::    *a               *a

See Also

External resources