hnock

A Nock interpreter.
git clone git://git.jtobin.io/hnock.git
Log | Files | Refs | README | LICENSE

4.txt (1009B)


      1 nock(a)             *a
      2 [a b c]             [a [b c]]
      3 
      4 ?[a b]              0
      5 ?a                  1
      6 +[a b]              +[a b]
      7 +a                  1 + a
      8 =[a a]              0
      9 =[a b]              1
     10 
     11 /[1 a]              a
     12 /[2 a b]            a
     13 /[3 a b]            b
     14 /[(a + a) b]        /[2 /[a b]]
     15 /[(a + a + 1) b]    /[3 /[a b]]
     16 /a                  /a
     17 
     18 #[1 a b]            a
     19 #[(a + a) b c]      #[a [b /[(a + a + 1) c]] c]
     20 #[(a + a + 1) b c]  #[a [/[(a + a) c] b] c]
     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 c]          =[*[a b] *[a c]]
     31 
     32 *[a 6 b c d]        *[a *[[c d] 0 *[[2 3] 0 *[a 4 4 b]]]]
     33 *[a 7 b c]          *[*[a b] c]
     34 *[a 8 b c]          *[[*[a b] a] c]
     35 *[a 9 b c]          *[*[a c] 2 [0 1] 0 b]
     36 *[a 10 [b c] d]     #[b *[a c] *[a d]]
     37 
     38 *[a 11 [b c] d]     *[[*[a c] *[a d]] 0 3]
     39 *[a 11 b c]         *[a c]
     40 
     41 *a                  *a