Update some of the docs.

This commit is contained in:
Simon Forman
2020-05-20 19:15:47 -07:00
parent 6a6b63bf62
commit ffabda0407
60 changed files with 5182 additions and 5853 deletions
+140 -140
View File
@@ -425,16 +425,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 1 [dup] 3 unquoted\n",
" 1 . [dup] 3 unquoted\n",
" 1 [dup] . 3 unquoted\n",
" 1 [dup] 3 . unquoted\n",
" 1 [dup] 3 . [i] dip\n",
"1 [dup] 3 [i] . dip\n",
" 1 [dup] . i 3\n",
" 1 . dup 3\n",
" 1 1 . 3\n",
" 1 1 3 . \n"
" 1 [dup] 3 unquoted\n",
" 1 [dup] 3 unquoted\n",
" 1 [dup] 3 unquoted\n",
" 1 [dup] 3 unquoted\n",
" 1 [dup] 3 [i] dip\n",
"1 [dup] 3 [i] dip\n",
" 1 [dup] i 3\n",
" 1 dup 3\n",
" 1 1 3\n",
" 1 1 3 \n"
]
}
],
@@ -1697,11 +1697,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 23 ?\n",
" 23 . ?\n",
" 23 . dup truthy\n",
" 23 23 . truthy\n",
"23 True . \n"
" 23 ?\n",
" 23 ?\n",
" 23 dup truthy\n",
" 23 23 truthy\n",
"23 True \n"
]
}
],
@@ -1992,9 +1992,9 @@
"program.\n",
"::\n",
"\n",
" ... x [Q] . app1\n",
" -----------------------------------\n",
" ... [x ...] [Q] . infra first\n",
" ... x [Q] . app1\n",
" -----------------------------------\n",
" ... [x ...] [Q] . infra first\n",
"\n",
"---- end (app1)\n",
"\n",
@@ -2055,10 +2055,10 @@
"Like app1 with two items.\n",
"::\n",
"\n",
" ... y x [Q] . app2\n",
" -----------------------------------\n",
" ... [y ...] [Q] . infra first\n",
" [x ...] [Q] infra first\n",
" ... y x [Q] . app2\n",
" -----------------------------------\n",
" ... [y ...] [Q] . infra first\n",
" [x ...] [Q] infra first\n",
"\n",
"---- end (app2)\n",
"\n",
@@ -2273,13 +2273,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 23 [++] dupdip *\n",
" 23 . [++] dupdip *\n",
"23 [++] . dupdip *\n",
" 23 . ++ 23 *\n",
" 24 . 23 *\n",
" 24 23 . *\n",
" 552 . \n"
" 23 [++] dupdip *\n",
" 23 [++] dupdip *\n",
"23 [++] dupdip *\n",
" 23 ++ 23 *\n",
" 24 23 *\n",
" 24 23 *\n",
" 552 \n"
]
}
],
@@ -2309,9 +2309,9 @@
"General Recursion Combinator.\n",
"::\n",
"\n",
" [if] [then] [rec1] [rec2] genrec\n",
" ---------------------------------------------------------------------\n",
" [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte\n",
" [if] [then] [rec1] [rec2] genrec\n",
" ---------------------------------------------------------------------\n",
" [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte\n",
"\n",
"From \"Recursion Theory and Joy\" (j05cmp.html) by Manfred von Thun:\n",
"\"The genrec combinator takes four program parameters in addition to\n",
@@ -2332,12 +2332,12 @@
"For example, given a (general recursive) function 'F':\n",
"::\n",
"\n",
" F == [I] [T] [R1] [R2] genrec\n",
" F == [I] [T] [R1] [R2] genrec\n",
"\n",
"If the [I] if-part fails you must derive R1 and R2 from:\n",
"::\n",
"\n",
" ... R1 [F] R2\n",
" ... R1 [F] R2\n",
"\n",
"Just set the stack arguments in front, and figure out what R1 and R2\n",
"have to do to apply the quoted [F] in the proper way. In effect, the\n",
@@ -2345,15 +2345,15 @@
"the original definition in the else-part:\n",
"::\n",
"\n",
" F == [I] [T] [R1] [R2] genrec\n",
" == [I] [T] [R1 [F] R2] ifte\n",
" F == [I] [T] [R1] [R2] genrec\n",
" == [I] [T] [R1 [F] R2] ifte\n",
"\n",
"Primitive recursive functions are those where R2 == i.\n",
"::\n",
"\n",
" P == [I] [T] [R] primrec\n",
" == [I] [T] [R [P] i] ifte\n",
" == [I] [T] [R P] ifte\n",
" P == [I] [T] [R] tailrec\n",
" == [I] [T] [R [P] i] ifte\n",
" == [I] [T] [R P] ifte\n",
"\n",
"---- end (genrec)\n",
"\n",
@@ -2400,14 +2400,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 1 2 3 [+ +] i\n",
" 1 . 2 3 [+ +] i\n",
" 1 2 . 3 [+ +] i\n",
" 1 2 3 . [+ +] i\n",
"1 2 3 [+ +] . i\n",
" 1 2 3 . + +\n",
" 1 5 . +\n",
" 6 . \n"
" 1 2 3 [+ +] i\n",
" 1 2 3 [+ +] i\n",
" 1 2 3 [+ +] i\n",
" 1 2 3 [+ +] i\n",
"1 2 3 [+ +] i\n",
" 1 2 3 + +\n",
" 1 5 +\n",
" 6 \n"
]
}
],
@@ -2473,17 +2473,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 1 2 3 [4 5 6] [* +] infra\n",
" 1 . 2 3 [4 5 6] [* +] infra\n",
" 1 2 . 3 [4 5 6] [* +] infra\n",
" 1 2 3 . [4 5 6] [* +] infra\n",
" 1 2 3 [4 5 6] . [* +] infra\n",
"1 2 3 [4 5 6] [* +] . infra\n",
" 6 5 4 . * + [3 2 1] swaack\n",
" 6 20 . + [3 2 1] swaack\n",
" 26 . [3 2 1] swaack\n",
" 26 [3 2 1] . swaack\n",
" 1 2 3 [26] . \n"
" 1 2 3 [4 5 6] [* +] infra\n",
" 1 2 3 [4 5 6] [* +] infra\n",
" 1 2 3 [4 5 6] [* +] infra\n",
" 1 2 3 [4 5 6] [* +] infra\n",
" 1 2 3 [4 5 6] [* +] infra\n",
"1 2 3 [4 5 6] [* +] infra\n",
" 6 5 4 * + [3 2 1] swaack\n",
" 6 20 + [3 2 1] swaack\n",
" 26 [3 2 1] swaack\n",
" 26 [3 2 1] swaack\n",
" 1 2 3 [26] \n"
]
}
],
@@ -2513,13 +2513,13 @@
"Basic loop combinator.\n",
"::\n",
"\n",
" ... True [Q] loop\n",
" ... True [Q] loop\n",
" -----------------------\n",
" ... Q [Q] loop\n",
" ... Q [Q] loop\n",
"\n",
" ... False [Q] loop\n",
" ... False [Q] loop\n",
" ------------------------\n",
" ...\n",
" ...\n",
"\n",
"---- end (loop)\n",
"\n",
@@ -2540,26 +2540,26 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 3 dup [1 - dup] loop\n",
" 3 . dup [1 - dup] loop\n",
" 3 3 . [1 - dup] loop\n",
"3 3 [1 - dup] . loop\n",
" 3 . 1 - dup [1 - dup] loop\n",
" 3 1 . - dup [1 - dup] loop\n",
" 2 . dup [1 - dup] loop\n",
" 2 2 . [1 - dup] loop\n",
"2 2 [1 - dup] . loop\n",
" 2 . 1 - dup [1 - dup] loop\n",
" 2 1 . - dup [1 - dup] loop\n",
" 1 . dup [1 - dup] loop\n",
" 1 1 . [1 - dup] loop\n",
"1 1 [1 - dup] . loop\n",
" 1 . 1 - dup [1 - dup] loop\n",
" 1 1 . - dup [1 - dup] loop\n",
" 0 . dup [1 - dup] loop\n",
" 0 0 . [1 - dup] loop\n",
"0 0 [1 - dup] . loop\n",
" 0 . \n"
" 3 dup [1 - dup] loop\n",
" 3 dup [1 - dup] loop\n",
" 3 3 [1 - dup] loop\n",
"3 3 [1 - dup] loop\n",
" 3 1 - dup [1 - dup] loop\n",
" 3 1 - dup [1 - dup] loop\n",
" 2 dup [1 - dup] loop\n",
" 2 2 [1 - dup] loop\n",
"2 2 [1 - dup] loop\n",
" 2 1 - dup [1 - dup] loop\n",
" 2 1 - dup [1 - dup] loop\n",
" 1 dup [1 - dup] loop\n",
" 1 1 [1 - dup] loop\n",
"1 1 [1 - dup] loop\n",
" 1 1 - dup [1 - dup] loop\n",
" 1 1 - dup [1 - dup] loop\n",
" 0 dup [1 - dup] loop\n",
" 0 0 [1 - dup] loop\n",
"0 0 [1 - dup] loop\n",
" 0 \n"
]
}
],
@@ -2706,19 +2706,19 @@
"Run a quoted program on each item in a sequence.\n",
"::\n",
"\n",
" ... [] [Q] . step\n",
" -----------------------\n",
" ... .\n",
" ... [] [Q] . step\n",
" -----------------------\n",
" ... .\n",
"\n",
"\n",
" ... [a] [Q] . step\n",
" ------------------------\n",
" ... a . Q\n",
" ... [a] [Q] . step\n",
" ------------------------\n",
" ... a . Q\n",
"\n",
"\n",
" ... [a b c] [Q] . step\n",
" ... [a b c] [Q] . step\n",
" ----------------------------------------\n",
" ... a . Q [b c] [Q] step\n",
" ... a . Q [b c] [Q] step\n",
"\n",
"The step combinator executes the quotation on each member of the list\n",
"on top of the stack.\n",
@@ -2744,23 +2744,23 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 0 [1 2 3] [+] step\n",
" 0 . [1 2 3] [+] step\n",
" 0 [1 2 3] . [+] step\n",
"0 [1 2 3] [+] . step\n",
" 0 1 [+] . i [2 3] [+] step\n",
" 0 1 . + [2 3] [+] step\n",
" 1 . [2 3] [+] step\n",
" 1 [2 3] . [+] step\n",
" 1 [2 3] [+] . step\n",
" 1 2 [+] . i [3] [+] step\n",
" 1 2 . + [3] [+] step\n",
" 3 . [3] [+] step\n",
" 3 [3] . [+] step\n",
" 3 [3] [+] . step\n",
" 3 3 [+] . i\n",
" 3 3 . +\n",
" 6 . \n"
" 0 [1 2 3] [+] step\n",
" 0 [1 2 3] [+] step\n",
" 0 [1 2 3] [+] step\n",
"0 [1 2 3] [+] step\n",
" 0 1 [+] i [2 3] [+] step\n",
" 0 1 + [2 3] [+] step\n",
" 1 [2 3] [+] step\n",
" 1 [2 3] [+] step\n",
" 1 [2 3] [+] step\n",
" 1 2 [+] i [3] [+] step\n",
" 1 2 + [3] [+] step\n",
" 3 [3] [+] step\n",
" 3 [3] [+] step\n",
" 3 [3] [+] step\n",
" 3 3 [+] i\n",
" 3 3 +\n",
" 6 \n"
]
}
],
@@ -2784,18 +2784,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 3 2 1 2 [+] times\n",
" 3 . 2 1 2 [+] times\n",
" 3 2 . 1 2 [+] times\n",
" 3 2 1 . 2 [+] times\n",
" 3 2 1 2 . [+] times\n",
"3 2 1 2 [+] . times\n",
" 3 2 1 . + 1 [+] times\n",
" 3 3 . 1 [+] times\n",
" 3 3 1 . [+] times\n",
" 3 3 1 [+] . times\n",
" 3 3 . +\n",
" 6 . \n"
" 3 2 1 2 [+] times\n",
" 3 2 1 2 [+] times\n",
" 3 2 1 2 [+] times\n",
" 3 2 1 2 [+] times\n",
" 3 2 1 2 [+] times\n",
"3 2 1 2 [+] times\n",
" 3 2 1 + 1 [+] times\n",
" 3 3 1 [+] times\n",
" 3 3 1 [+] times\n",
" 3 3 1 [+] times\n",
" 3 3 +\n",
" 6 \n"
]
}
],
@@ -2848,14 +2848,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 1 2 [3] [4] b\n",
" 1 . 2 [3] [4] b\n",
" 1 2 . [3] [4] b\n",
" 1 2 [3] . [4] b\n",
"1 2 [3] [4] . b\n",
" 1 2 . 3 4\n",
" 1 2 3 . 4\n",
" 1 2 3 4 . \n"
" 1 2 [3] [4] b\n",
" 1 2 [3] [4] b\n",
" 1 2 [3] [4] b\n",
" 1 2 [3] [4] b\n",
"1 2 [3] [4] b\n",
" 1 2 3 4\n",
" 1 2 3 4\n",
" 1 2 3 4 \n"
]
}
],
@@ -2934,16 +2934,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
" . 1 [2] [i 3] x\n",
" 1 . [2] [i 3] x\n",
" 1 [2] . [i 3] x\n",
"1 [2] [i 3] . x\n",
"1 [2] [i 3] . i 3\n",
" 1 [2] . i 3 3\n",
" 1 . 2 3 3\n",
" 1 2 . 3 3\n",
" 1 2 3 . 3\n",
" 1 2 3 3 . \n"
" 1 [2] [i 3] x\n",
" 1 [2] [i 3] x\n",
" 1 [2] [i 3] x\n",
"1 [2] [i 3] x\n",
"1 [2] [i 3] i 3\n",
" 1 [2] i 3 3\n",
" 1 2 3 3\n",
" 1 2 3 3\n",
" 1 2 3 3\n",
" 1 2 3 3 \n"
]
}
],
@@ -3037,14 +3037,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,