mirror of
https://github.com/urbit/shrub.git
synced 2024-11-27 10:26:14 +03:00
parent
dac240bdfa
commit
4815215eb9
70
doc/spec/nock/10.txt
Normal file
70
doc/spec/nock/10.txt
Normal file
@ -0,0 +1,70 @@
|
||||
Author: Mencius Moldbug [moldbug@gmail.com]
|
||||
Date: 9/15/2008
|
||||
Version: 10K
|
||||
|
||||
1. Introduction
|
||||
|
||||
This file defines one function, "nock."
|
||||
|
||||
nock is in the public domain.
|
||||
|
||||
2. Data
|
||||
|
||||
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
|
||||
integer of any size. A "cell" is an ordered pair of any two nouns,
|
||||
the "head" and "tail."
|
||||
|
||||
3. Semantics
|
||||
|
||||
nock maps one noun to another. It doesn't always terminate.
|
||||
|
||||
4. Pseudocode
|
||||
|
||||
nock is defined in a pattern-matching pseudocode, below.
|
||||
|
||||
Brackets enclose cells. [a b c] is [a [b c]].
|
||||
|
||||
5. Definition
|
||||
|
||||
5.1 Transformations
|
||||
|
||||
*[a [b c] d] => [*[a b c] *[a d]]
|
||||
*[a 0 b] => /[b a]
|
||||
*[a 1 b] => [b]
|
||||
*[a 2 b c d] => *[a 3 [0 1] 3 [1 c d] [1 0] 3 [1 2 3] [1 0] 5 5 b]
|
||||
*[a 3 b] => **[a b]
|
||||
*[a 4 b] => &*[a b]
|
||||
*[a 5 b] => ^*[a b]
|
||||
*[a 6 b] => =*[a b]
|
||||
*[a] => *[a]
|
||||
|
||||
5.2 Operators
|
||||
|
||||
5.2.1 Goto [*]
|
||||
|
||||
*[a] -> nock[a]
|
||||
|
||||
5.2.2 Deep [&]
|
||||
|
||||
&[a b] -> 0
|
||||
&[a] -> 1
|
||||
|
||||
5.2.4 Bump [^]
|
||||
|
||||
^[a b] -> ^[a b]
|
||||
^[a] -> (a + 1)
|
||||
|
||||
5.2.5 Like [=]
|
||||
|
||||
=[a a] -> 0
|
||||
=[a b] -> 1
|
||||
=[a] -> =[a]
|
||||
|
||||
5.2.6 Snip [/]
|
||||
|
||||
/[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]
|
74
doc/spec/nock/11.txt
Normal file
74
doc/spec/nock/11.txt
Normal file
@ -0,0 +1,74 @@
|
||||
Author: Mencius Moldbug (moldbug@gmail.com)
|
||||
Date: 5/25/2008
|
||||
Version: 11K
|
||||
|
||||
1. Introduction
|
||||
|
||||
This file defines one function, "nock."
|
||||
|
||||
nock is in the public domain.
|
||||
|
||||
2. Data
|
||||
|
||||
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
|
||||
integer of any size. A "cell" is an ordered pair of any two nouns,
|
||||
the "head" and "tail."
|
||||
|
||||
3. Semantics
|
||||
|
||||
nock maps one noun to another. It doesn't always terminate.
|
||||
|
||||
4. Pseudocode
|
||||
|
||||
nock is defined in a pattern-matching pseudocode, below.
|
||||
|
||||
Parentheses enclose cells. (a b c) is (a (b c)).
|
||||
|
||||
5. Definition
|
||||
|
||||
5.1 Transformations
|
||||
|
||||
*(a (b c) d) => (*(a b c) *(a d))
|
||||
*(a 0 b) => /(b a)
|
||||
*(a 1 b) => (b)
|
||||
*(a 2 b c d) => *(a 3 (0 1) 3 (1 c d) (1 0) 3 (1 2 3) (1 0) 5 5 b)
|
||||
*(a 3 b) => **(a b)
|
||||
*(a 4 b) => &*(a b)
|
||||
*(a 5 b) => ^*(a b)
|
||||
*(a 6 b) => =*(a b)
|
||||
|
||||
*(a 7 b c) => *(a 3 (((1 0) b) c) 1 0 3)
|
||||
*(a 8 b c) => *(a c)
|
||||
|
||||
*(a) => *(a)
|
||||
|
||||
5.2 Operators
|
||||
|
||||
5.2.1 Goto (*)
|
||||
|
||||
*(a) -> nock(a)
|
||||
|
||||
5.2.2 Deep (&)
|
||||
|
||||
&(a b) -> 0
|
||||
&(a) -> 1
|
||||
|
||||
5.2.4 Bump (^)
|
||||
|
||||
^(a b) -> ^(a b)
|
||||
^(a) -> a + 1
|
||||
|
||||
5.2.5 Same (=)
|
||||
|
||||
=(a a) -> 0
|
||||
=(a b) -> 1
|
||||
=(a) -> =(a)
|
||||
|
||||
5.2.6 Snip (/)
|
||||
|
||||
/(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)
|
75
doc/spec/nock/12.txt
Normal file
75
doc/spec/nock/12.txt
Normal file
@ -0,0 +1,75 @@
|
||||
Author: Curtis Yarvin (curtis.yarvin@gmail.com)
|
||||
Date: 3/28/2008
|
||||
Version: 0.12
|
||||
|
||||
1. Introduction
|
||||
|
||||
This file defines one function, "nock."
|
||||
|
||||
nock is in the public domain.
|
||||
|
||||
2. Data
|
||||
|
||||
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
|
||||
integer of any size. A "cell" is an ordered pair of any two nouns,
|
||||
the "head" and "tail."
|
||||
|
||||
3. Semantics
|
||||
|
||||
nock maps one noun to another. It doesn't always terminate.
|
||||
|
||||
4. Pseudocode
|
||||
|
||||
nock is defined in a pattern-matching pseudocode, below.
|
||||
|
||||
Parentheses enclose cells. (a b c) is (a (b c)).
|
||||
|
||||
5. Definition
|
||||
|
||||
5.1 Transformations
|
||||
|
||||
*(a (b c) d) => (*(a b c) *(a d))
|
||||
*(a 0 b) => /(b a)
|
||||
*(a 1 b) => (b)
|
||||
*(a 2 b c) => *(*(a b) c)
|
||||
*(a 3 b) => **(a b)
|
||||
*(a 4 b) => &*(a b)
|
||||
*(a 5 b) => ^*(a b)
|
||||
*(a 6 b) => =*(a b)
|
||||
|
||||
*(a 7 b c d) => *(a 3 (0 1) 3 (1 c d) (1 0) 3 (1 2 3) (1 0) 5 5 b)
|
||||
*(a 8 b c) => *(a 2 (((1 0) b) c) 0 3)
|
||||
*(a 9 b c) => *(a c)
|
||||
|
||||
*(a) => *(a)
|
||||
|
||||
5.2 Operators
|
||||
|
||||
5.2.1 Goto (*)
|
||||
|
||||
*(a) -> nock(a)
|
||||
|
||||
5.2.2 Deep (&)
|
||||
|
||||
&(a b) -> 0
|
||||
&(a) -> 1
|
||||
|
||||
5.2.4 Bump (^)
|
||||
|
||||
^(a b) -> ^(a b)
|
||||
^(a) -> a + 1
|
||||
|
||||
5.2.5 Same (=)
|
||||
|
||||
=(a a) -> 0
|
||||
=(a b) -> 1
|
||||
=(a) -> =(a)
|
||||
|
||||
5.2.6 Snip (/)
|
||||
|
||||
/(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)
|
71
doc/spec/nock/13.txt
Normal file
71
doc/spec/nock/13.txt
Normal file
@ -0,0 +1,71 @@
|
||||
Author: Curtis Yarvin (curtis.yarvin@gmail.com)
|
||||
Date: 3/8/2008
|
||||
Version: 0.13
|
||||
|
||||
1. Manifest
|
||||
|
||||
This file defines one Turing-complete function, "nock."
|
||||
|
||||
nock is in the public domain. So far as I know, it is
|
||||
neither patentable nor patented. Use it at your own risk.
|
||||
|
||||
2. Data
|
||||
|
||||
Both the domain and range of nock are "nouns."
|
||||
|
||||
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
|
||||
integer of any size. A "cell" is an ordered pair of any two nouns,
|
||||
the "head" and "tail."
|
||||
|
||||
3. Pseudocode
|
||||
|
||||
nock is defined in a pattern-matching pseudocode.
|
||||
|
||||
Match precedence is top-down. Operators are prefix. Parens
|
||||
denote cells, and group right: (a b c) is (a (b c)).
|
||||
|
||||
4. Definition
|
||||
|
||||
4.1 Transformations
|
||||
|
||||
*(a 0 b c) => *(*(a b) c)
|
||||
*(a 0 b) => /(b a)
|
||||
*(a 1 b) => (b)
|
||||
*(a 2 b) => **(a b)
|
||||
*(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 b c) => (*(a b) *(a c))
|
||||
*(a) => *(a)
|
||||
|
||||
4.2 Operators
|
||||
|
||||
4.2.1 Goto (*)
|
||||
|
||||
*(a) -> nock(a)
|
||||
|
||||
4.2.2 Deep (&)
|
||||
|
||||
&(a b) -> 0
|
||||
&(a) -> 1
|
||||
|
||||
4.2.3 Bump (^)
|
||||
|
||||
^(a b) -> ^(a b)
|
||||
^(a) -> a + 1
|
||||
|
||||
4.2.4 Same (=)
|
||||
|
||||
=(a a) -> 0
|
||||
=(a b) -> 1
|
||||
=(a) -> =(a)
|
||||
|
||||
4.2.5 Snip (/)
|
||||
|
||||
/(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)
|
42
doc/spec/nock/6.txt
Normal file
42
doc/spec/nock/6.txt
Normal file
@ -0,0 +1,42 @@
|
||||
1 Structures
|
||||
|
||||
A noun is an atom or a cell. An atom is any natural number.
|
||||
A cell is an ordered pair of nouns.
|
||||
|
||||
2 Reductions
|
||||
|
||||
nock(a) *a
|
||||
[a b c] [a [b c]]
|
||||
|
||||
?[a b] 0
|
||||
?a 1
|
||||
+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 [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 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 [[0 1] b] c]
|
||||
*[a 9 b c] *[a 7 c 0 b]
|
||||
*[a 10 b c] *[a c]
|
||||
*[a 10 [b c] d] *[a 8 c 7 [0 2] d]
|
||||
|
||||
+[a b] +[a b]
|
||||
=a =a
|
||||
/a /a
|
||||
*a *a
|
42
doc/spec/nock/7.txt
Normal file
42
doc/spec/nock/7.txt
Normal file
@ -0,0 +1,42 @@
|
||||
1 Structures
|
||||
|
||||
A noun is an atom or a cell. An atom is any natural number.
|
||||
A cell is any ordered pair of nouns.
|
||||
|
||||
2 Pseudocode
|
||||
|
||||
[a b c] [a [b c]]
|
||||
nock(a) *a
|
||||
|
||||
?[a b] 0
|
||||
?a 1
|
||||
^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 [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 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 0 b]
|
||||
*[a 10 b c] *[a c]
|
||||
*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
|
||||
|
||||
^[a b] ^[a b]
|
||||
=a =a
|
||||
/a /a
|
||||
*a *a
|
45
doc/spec/nock/8.txt
Normal file
45
doc/spec/nock/8.txt
Normal file
@ -0,0 +1,45 @@
|
||||
1 Structures
|
||||
|
||||
A noun is an atom or a cell. An atom is any unsigned integer.
|
||||
A cell is an ordered pair of nouns.
|
||||
|
||||
2 Pseudocode
|
||||
|
||||
[a b c] is [a [b c]]; *a is nock(a). Reductions match top-down.
|
||||
|
||||
3 Reductions
|
||||
|
||||
?[a b] 0
|
||||
?a 1
|
||||
^a (a + 1)
|
||||
=[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 [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 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 b [0 1]] c]
|
||||
*[a 9 b c] *[a 8 b 2 [[7 [0 3] d] [0 5]] 0 5]
|
||||
*[a 10 b c] *[a 8 b 8 [7 [0 3] c] 0 2]
|
||||
*[a 11 b c] *[a 8 b 7 [0 3] c]
|
||||
*[a 12 b c] *[a [1 0] 1 c]
|
||||
|
||||
^[a b] ^[a b]
|
||||
=a =a
|
||||
/a /a
|
||||
*a *a
|
||||
|
||||
|
43
doc/spec/nock/9.txt
Normal file
43
doc/spec/nock/9.txt
Normal file
@ -0,0 +1,43 @@
|
||||
1 Context
|
||||
|
||||
This spec defines one function, Nock.
|
||||
|
||||
2 Structures
|
||||
|
||||
A noun is an atom or a cell. An atom is any unsigned integer.
|
||||
A cell is an ordered pair of any two nouns.
|
||||
|
||||
3 Pseudocode
|
||||
|
||||
Brackets enclose cells. [a b c] is [a [b c]].
|
||||
|
||||
*a is Nock(a). Reductions match top-down.
|
||||
|
||||
4 Reductions
|
||||
|
||||
?[a b] => 0
|
||||
?a => 1
|
||||
|
||||
^[a b] => ^[a b]
|
||||
^a => (a + 1)
|
||||
|
||||
=[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
|
||||
|
||||
*[a 0 b] => /[b a]
|
||||
*[a 1 b] => b
|
||||
*[a 2 b c d] => *[a 3 [0 1] 3 [1 c d] [1 0] 3 [1 2 3] [1 0] 5 5 b]
|
||||
*[a 3 b] => **[a b]
|
||||
*[a 4 b] => ?*[a b]
|
||||
*[a 5 b] => ^*[a b]
|
||||
*[a 6 b] => =*[a b]
|
||||
*[a [b c] d] => [*[a b c] *[a d]]
|
||||
*a => *a
|
Loading…
Reference in New Issue
Block a user