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
+137 -137
View File
@@ -184,16 +184,16 @@ J('1 [2] 3 unquoted')
V('1 [dup] 3 unquoted') # Unquoting evaluates. Be aware.
```
. 1 [dup] 3 unquoted
1 . [dup] 3 unquoted
1 [dup] . 3 unquoted
1 [dup] 3 . unquoted
1 [dup] 3 . [i] dip
1 [dup] 3 [i] . dip
1 [dup] . i 3
1 . dup 3
1 1 . 3
1 1 3 .
1 [dup] 3 unquoted
1 [dup] 3 unquoted
1 [dup] 3 unquoted
1 [dup] 3 unquoted
1 [dup] 3 [i] dip
1 [dup] 3 [i] dip
1 [dup] i 3
1 dup 3
1 1 3
1 1 3
# List words
@@ -730,11 +730,11 @@ J('0 truthy')
V('23 ?')
```
. 23 ?
23 . ?
23 . dup truthy
23 23 . truthy
23 True .
23 ?
23 ?
23 dup truthy
23 23 truthy
23 True
@@ -872,9 +872,9 @@ J('[app1] help')
program.
::
... x [Q] . app1
-----------------------------------
... [x ...] [Q] . infra first
... x [Q] . app1
-----------------------------------
... [x ...] [Q] . infra first
---- end (app1)
@@ -908,10 +908,10 @@ J('[app2] help')
Like app1 with two items.
::
... y x [Q] . app2
-----------------------------------
... [y ...] [Q] . infra first
[x ...] [Q] infra first
... y x [Q] . app2
-----------------------------------
... [y ...] [Q] . infra first
[x ...] [Q] infra first
---- end (app2)
@@ -1020,13 +1020,13 @@ Expects a quoted program `[Q]` on the stack and some item under it, `dup` the it
V('23 [++] dupdip *') # N(N + 1)
```
. 23 [++] dupdip *
23 . [++] dupdip *
23 [++] . dupdip *
23 . ++ 23 *
24 . 23 *
24 23 . *
552 .
23 [++] dupdip *
23 [++] dupdip *
23 [++] dupdip *
23 ++ 23 *
24 23 *
24 23 *
552
### `genrec` `primrec`
@@ -1042,9 +1042,9 @@ J('[genrec] help')
General Recursion Combinator.
::
[if] [then] [rec1] [rec2] genrec
---------------------------------------------------------------------
[if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte
[if] [then] [rec1] [rec2] genrec
---------------------------------------------------------------------
[if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte
From "Recursion Theory and Joy" (j05cmp.html) by Manfred von Thun:
"The genrec combinator takes four program parameters in addition to
@@ -1065,12 +1065,12 @@ J('[genrec] help')
For example, given a (general recursive) function 'F':
::
F == [I] [T] [R1] [R2] genrec
F == [I] [T] [R1] [R2] genrec
If the [I] if-part fails you must derive R1 and R2 from:
::
... R1 [F] R2
... R1 [F] R2
Just set the stack arguments in front, and figure out what R1 and R2
have to do to apply the quoted [F] in the proper way. In effect, the
@@ -1078,15 +1078,15 @@ J('[genrec] help')
the original definition in the else-part:
::
F == [I] [T] [R1] [R2] genrec
== [I] [T] [R1 [F] R2] ifte
F == [I] [T] [R1] [R2] genrec
== [I] [T] [R1 [F] R2] ifte
Primitive recursive functions are those where R2 == i.
::
P == [I] [T] [R] primrec
== [I] [T] [R [P] i] ifte
== [I] [T] [R P] ifte
P == [I] [T] [R] tailrec
== [I] [T] [R [P] i] ifte
== [I] [T] [R P] ifte
---- end (genrec)
@@ -1108,14 +1108,14 @@ J('3 [1 <=] [] [dup --] [i *] genrec')
V('1 2 3 [+ +] i')
```
. 1 2 3 [+ +] i
1 . 2 3 [+ +] i
1 2 . 3 [+ +] i
1 2 3 . [+ +] i
1 2 3 [+ +] . i
1 2 3 . + +
1 5 . +
6 .
1 2 3 [+ +] i
1 2 3 [+ +] i
1 2 3 [+ +] i
1 2 3 [+ +] i
1 2 3 [+ +] i
1 2 3 + +
1 5 +
6
### `ifte`
@@ -1144,17 +1144,17 @@ J('1 2 [0] [+] [*] ifte')
V('1 2 3 [4 5 6] [* +] infra')
```
. 1 2 3 [4 5 6] [* +] infra
1 . 2 3 [4 5 6] [* +] infra
1 2 . 3 [4 5 6] [* +] infra
1 2 3 . [4 5 6] [* +] infra
1 2 3 [4 5 6] . [* +] infra
1 2 3 [4 5 6] [* +] . infra
6 5 4 . * + [3 2 1] swaack
6 20 . + [3 2 1] swaack
26 . [3 2 1] swaack
26 [3 2 1] . swaack
1 2 3 [26] .
1 2 3 [4 5 6] [* +] infra
1 2 3 [4 5 6] [* +] infra
1 2 3 [4 5 6] [* +] infra
1 2 3 [4 5 6] [* +] infra
1 2 3 [4 5 6] [* +] infra
1 2 3 [4 5 6] [* +] infra
6 5 4 * + [3 2 1] swaack
6 20 + [3 2 1] swaack
26 [3 2 1] swaack
26 [3 2 1] swaack
1 2 3 [26]
### `loop`
@@ -1170,13 +1170,13 @@ J('[loop] help')
Basic loop combinator.
::
... True [Q] loop
... True [Q] loop
-----------------------
... Q [Q] loop
... Q [Q] loop
... False [Q] loop
... False [Q] loop
------------------------
...
...
---- end (loop)
@@ -1188,26 +1188,26 @@ J('[loop] help')
V('3 dup [1 - dup] loop')
```
. 3 dup [1 - dup] loop
3 . dup [1 - dup] loop
3 3 . [1 - dup] loop
3 3 [1 - dup] . loop
3 . 1 - dup [1 - dup] loop
3 1 . - dup [1 - dup] loop
2 . dup [1 - dup] loop
2 2 . [1 - dup] loop
2 2 [1 - dup] . loop
2 . 1 - dup [1 - dup] loop
2 1 . - dup [1 - dup] loop
1 . dup [1 - dup] loop
1 1 . [1 - dup] loop
1 1 [1 - dup] . loop
1 . 1 - dup [1 - dup] loop
1 1 . - dup [1 - dup] loop
0 . dup [1 - dup] loop
0 0 . [1 - dup] loop
0 0 [1 - dup] . loop
0 .
3 dup [1 - dup] loop
3 dup [1 - dup] loop
3 3 [1 - dup] loop
3 3 [1 - dup] loop
3 1 - dup [1 - dup] loop
3 1 - dup [1 - dup] loop
2 dup [1 - dup] loop
2 2 [1 - dup] loop
2 2 [1 - dup] loop
2 1 - dup [1 - dup] loop
2 1 - dup [1 - dup] loop
1 dup [1 - dup] loop
1 1 [1 - dup] loop
1 1 [1 - dup] loop
1 1 - dup [1 - dup] loop
1 1 - dup [1 - dup] loop
0 dup [1 - dup] loop
0 0 [1 - dup] loop
0 0 [1 - dup] loop
0
### `map` `pam`
@@ -1276,19 +1276,19 @@ J('[step] help')
Run a quoted program on each item in a sequence.
::
... [] [Q] . step
-----------------------
... .
... [] [Q] . step
-----------------------
... .
... [a] [Q] . step
------------------------
... a . Q
... [a] [Q] . step
------------------------
... a . Q
... [a b c] [Q] . step
... [a b c] [Q] . step
----------------------------------------
... a . Q [b c] [Q] step
... a . Q [b c] [Q] step
The step combinator executes the quotation on each member of the list
on top of the stack.
@@ -1303,23 +1303,23 @@ J('[step] help')
V('0 [1 2 3] [+] step')
```
. 0 [1 2 3] [+] step
0 . [1 2 3] [+] step
0 [1 2 3] . [+] step
0 [1 2 3] [+] . step
0 1 [+] . i [2 3] [+] step
0 1 . + [2 3] [+] step
1 . [2 3] [+] step
1 [2 3] . [+] step
1 [2 3] [+] . step
1 2 [+] . i [3] [+] step
1 2 . + [3] [+] step
3 . [3] [+] step
3 [3] . [+] step
3 [3] [+] . step
3 3 [+] . i
3 3 . +
6 .
0 [1 2 3] [+] step
0 [1 2 3] [+] step
0 [1 2 3] [+] step
0 [1 2 3] [+] step
0 1 [+] i [2 3] [+] step
0 1 + [2 3] [+] step
1 [2 3] [+] step
1 [2 3] [+] step
1 [2 3] [+] step
1 2 [+] i [3] [+] step
1 2 + [3] [+] step
3 [3] [+] step
3 [3] [+] step
3 [3] [+] step
3 3 [+] i
3 3 +
6
### `times`
@@ -1329,18 +1329,18 @@ V('0 [1 2 3] [+] step')
V('3 2 1 2 [+] times')
```
. 3 2 1 2 [+] times
3 . 2 1 2 [+] times
3 2 . 1 2 [+] times
3 2 1 . 2 [+] times
3 2 1 2 . [+] times
3 2 1 2 [+] . times
3 2 1 . + 1 [+] times
3 3 . 1 [+] times
3 3 1 . [+] times
3 3 1 [+] . times
3 3 . +
6 .
3 2 1 2 [+] times
3 2 1 2 [+] times
3 2 1 2 [+] times
3 2 1 2 [+] times
3 2 1 2 [+] times
3 2 1 2 [+] times
3 2 1 + 1 [+] times
3 3 1 [+] times
3 3 1 [+] times
3 3 1 [+] times
3 3 +
6
### `b`
@@ -1370,14 +1370,14 @@ J('[b] help')
V('1 2 [3] [4] b')
```
. 1 2 [3] [4] b
1 . 2 [3] [4] b
1 2 . [3] [4] b
1 2 [3] . [4] b
1 2 [3] [4] . b
1 2 . 3 4
1 2 3 . 4
1 2 3 4 .
1 2 [3] [4] b
1 2 [3] [4] b
1 2 [3] [4] b
1 2 [3] [4] b
1 2 [3] [4] b
1 2 3 4
1 2 3 4
1 2 3 4
### `while`
@@ -1419,16 +1419,16 @@ J('[x] help')
V('1 [2] [i 3] x') # Kind of a pointless example.
```
. 1 [2] [i 3] x
1 . [2] [i 3] x
1 [2] . [i 3] x
1 [2] [i 3] . x
1 [2] [i 3] . i 3
1 [2] . i 3 3
1 . 2 3 3
1 2 . 3 3
1 2 3 . 3
1 2 3 3 .
1 [2] [i 3] x
1 [2] [i 3] x
1 [2] [i 3] x
1 [2] [i 3] x
1 [2] [i 3] i 3
1 [2] i 3 3
1 2 3 3
1 2 3 3
1 2 3 3
1 2 3 3
# `void`