Nitpicky edit to Nock was wrong. Reverting, but changing formatting for clarity. Nock 5K now at 353 bytes.

This commit is contained in:
johncburnham 2013-11-13 20:57:55 -08:00
parent ab1cfc58ab
commit 6cb3ba1778
2 changed files with 61 additions and 65 deletions

View File

@ -2,7 +2,7 @@
:: Hoon/Arvo stage 191 (reflexive).
:: This file is in the public domain.
::
:: A noun is an atom or a cell. An atom is any natural number
:: A noun is an atom or a cell. An atom is a natural number
:: (ie, unsigned integer). A cell is an ordered pair of nouns.
::
:: Noun A is this file, hoon.hoon, encoded as an atom, LSB first.
@ -15,41 +15,41 @@
::
:: Consider this Turing-complete non-lambda automaton, "Nock":
::
:: nock(a) *a
:: 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
:: =a =a
:: ?[a b] 0
:: ?a 1
:: +[a b] +[a b]
:: +a 1 + a
:: =[a a] 0
:: =[a b] 1
:: =a =a
::
:: /[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] a
:: /[2 [a b]] a
:: /[3 [a b]] b
:: /[(a + a) b] /[2 /[a b]]
:: /[(a + a + 1) b] /[3 /[a b]]
:: /a /a
::
:: *[a [b c] d] [*[a b c] *[a d]]
:: *[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] =*[a b]
:: *[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]] =*[a b]
::
:: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
:: *[a 7 b c] *[a 2 b 1 c]
:: *[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
:: *[a 9 b c] *[a 7 c 2 [0 1] 0 b]
:: *[a 10 [b c] d] *[a 8 c 7 [0 3] d]
:: *[a 10 b c] *[a c]
:: *[a [6 [b [c d]]]] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
:: *[a [7 [b c]]] *[a 2 b 1 c]
:: *[a [8 [b c]]] *[a 7 [[7 [0 1] b] 0 1] c]
:: *[a [9 [b c]]] *[a 7 c 2 [0 1] 0 b]
:: *[a [10 [[b c] d]]] *[a 8 c 7 [0 3] d]
:: *[a [10 [b c]]] *[a c]
::
:: [a b c] [a [b c]]
:: *a *a
:: *a *a
::
:: In a reflexive stage X, we assert, *[A_X B_X] yields B_X.
:: Ie, hoon.hoon is a self-compiling compiler against Nock.

View File

@ -1,42 +1,38 @@
1 Structures
A noun is an atom or a cell. An atom is a natural number.
A cell is an ordered pair of nouns.
A noun is an atom or a cell. An atom is any natural number.
A cell is an ordered pair of nouns.
nock(a) *a
[a b c] [a [b c]]
2 Reductions
?[a b] 0
?a 1
+[a b] +[a b]
+a 1 + a
=[a a] 0
=[a b] 1
=a =a
nock(a) *a
/[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
?[a b] 0
?a 1
+[a b] +[a b]
+a 1 + a
=[a a] 0
=[a b] 1
=a =a
*[a [[b c] d]] [*[a b c] *[a d]]
/[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
*[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]] =*[a b]
*[a [b c] d] [*[a b c] *[a d]]
*[a [6 [b [c d]]]] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a [7 [b c]]] *[a 2 b 1 c]
*[a [8 [b c]]] *[a 7 [[7 [0 1] b] 0 1] c]
*[a [9 [b c]]] *[a 7 c 2 [0 1] 0 b]
*[a [10 [[b c] d]]] *[a 8 c 7 [0 3] d]
*[a [10 [b c]]] *[a c]
*[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] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
*[a 9 b c] *[a 7 c 2 [0 1] 0 b]
*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
*[a 10 b c] *[a c]
[a b c] [a [b c]]
*a *a
*a *a