diff --git a/docs/reference/eq.md b/docs/reference/eq.md index 7340fb9..26ef0c7 100644 --- a/docs/reference/eq.md +++ b/docs/reference/eq.md @@ -10,10 +10,7 @@ them with a Boolean value. a b eq ------------- Boolean - -### Discussion - -Lorem ipsum. + (a = b) ### Crosslinks diff --git a/docs/reference/gcd.md b/docs/reference/gcd.md index b9f812a..625d534 100644 --- a/docs/reference/gcd.md +++ b/docs/reference/gcd.md @@ -2,28 +2,16 @@ ## gcd -Basis Function Combinator +Function -true \[tuck mod dup 0 \>\] loop pop - -Gentzen diagram. +Take two integers from the stack and replace them with their Greatest +Common Denominator. ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> true \[[tuck] [mod] [dup] 0 [>]\] [loop] [pop] ### Discussion -Lorem ipsum. +Euclid's Algorithm -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/gcd2.md b/docs/reference/gcd2.md index c640544..30d8598 100644 --- a/docs/reference/gcd2.md +++ b/docs/reference/gcd2.md @@ -2,28 +2,15 @@ ## gcd2 -Basis Function Combinator +Function Compiled GCD function. -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +See [gcd]. ### Crosslinks -Lorem ipsum. +[gcd] + diff --git a/docs/reference/ge.md b/docs/reference/ge.md index 7c26c7a..c46afd0 100644 --- a/docs/reference/ge.md +++ b/docs/reference/ge.md @@ -2,28 +2,22 @@ ## ge -Basis Function Combinator +Basis Function -Same as a \>= b. +Greater-than-or-equal-to comparison of two numbers. -Gentzen diagram. + a b ge + -------------- + Boolean + (a >= b) -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. ### Crosslinks -Lorem ipsum. +[cmp] +[eq] +[gt] +[le] +[lt] +[ne] + diff --git a/docs/reference/genrec.md b/docs/reference/genrec.md index 917fffd..3104791 100644 --- a/docs/reference/genrec.md +++ b/docs/reference/genrec.md @@ -2,70 +2,70 @@ ## genrec -Basis Function Combinator +Combinator -General Recursion Combinator. : +**Gen**eral **Rec**ursion Combinator. - [if] [then] [rec1] [rec2] genrec + [if] [then] [rec1] [rec2] genrec --------------------------------------------------------------------- - [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte + [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 -whatever data parameters it needs. Fourth from the top is an if-part, -followed by a then-part. If the if-part yields true, then the then-part -is executed and the combinator terminates. The other two parameters are -the rec1-part and the rec2-part. If the if-part yields false, the -rec1-part is executed. Following that the four program parameters and -the combinator are again pushed onto the stack bundled up in a quoted -form. Then the rec2-part is executed, where it will find the bundled -form. Typically it will then execute the bundled form, either with i or -with app2, or some other combinator.\" +### Definition -The way to design one of these is to fix your base case \[then\] and the -test \[if\], and then treat rec1 and rec2 as an else-part -\"sandwiching\" a quotation of the whole function. +> \[\[[genrec]\] [ccccons]\] [nullary] [swons] [concat] [ifte] -For example, given a (general recursive) function \'F\': : +(Note that this definition includes the `genrec` symbol itself, it is +self-referential. This is possible because the definition machinery does +not check that symbols in defs are in the dictionary. `genrec` is the +only self-referential definition.) + +### Discussion + +See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html). + +From ["Recursion Theory and Joy"](https://www.kevinalbrecht.com/code/joy-mirror/j05cmp.html) +by Manfred von Thun: + +> "The genrec combinator takes four program parameters in addition to +> whatever data parameters it needs. Fourth from the top is an if-part, +> followed by a then-part. If the if-part yields true, then the then-part +> is executed and the combinator terminates. The other two parameters are +> the rec1-part and the rec2-part. If the if-part yields false, the +> rec1-part is executed. Following that the four program parameters and +> the combinator are again pushed onto the stack bundled up in a quoted +> form. Then the rec2-part is executed, where it will find the bundled +> form. Typically it will then execute the bundled form, either with i +> or with app2, or some other combinator." + +The way to design one of these is to fix your base case `[then]` and the +test `[if]`, and then treat `rec1` and `rec2` as an else-part +"sandwiching" a quotation of the whole function. + +For example, given a (general recursive) function `F`: F == [I] [T] [R1] [R2] genrec -If the \[I\] if-part fails you must derive R1 and R2 from: : +If the `[I]` if-part fails you must derive `R1` and `R2` from: : ... 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 -genrec combinator turns into an ifte combinator with a quoted copy of -the original definition in the else-part: : +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 +`genrec` combinator turns into an [ifte] combinator with a quoted copy of +the original definition in the else-part: F == [I] [T] [R1] [R2] genrec == [I] [T] [R1 [F] R2] ifte -Primitive recursive functions are those where R2 == i. : +Tail recursive functions are those where `R2` is the `i` combinator: P == [I] [T] [R] tailrec == [I] [T] [R [P] i] ifte == [I] [T] [R P] ifte -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - ### Crosslinks -Lorem ipsum. +[anamorphism] +[tailrec] +[x] + diff --git a/docs/reference/getitem.md b/docs/reference/getitem.md index 446dd9f..7725ee0 100644 --- a/docs/reference/getitem.md +++ b/docs/reference/getitem.md @@ -2,35 +2,45 @@ ## getitem -Basis Function Combinator - - getitem == drop first +Function Expects an integer and a quote on the stack and returns the item at the -nth position in the quote counting from 0. : +nth position in the quote counting from 0. - [a b c d] 0 getitem +### Example + + [a b c d] 2 getitem ------------------------- - a - -Gentzen diagram. + c ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> [drop] [first] ### Discussion -Lorem ipsum. +If the number isn't a valid index into the quote `getitem` will cause +some sort of problem (the exact nature of which is +implementation-dependant.) ### Crosslinks -Lorem ipsum. +[concat] +[first] +[first_two] +[flatten] +[fourth] +[remove] +[rest] +[reverse] +[rrest] +[second] +[shift] +[shunt] +[size] +[sort] +[split_at] +[split_list] +[swaack] +[third] +[zip] diff --git a/docs/reference/grabN.md b/docs/reference/grabN.md index be3b6d6..78ab208 100644 --- a/docs/reference/grabN.md +++ b/docs/reference/grabN.md @@ -2,7 +2,7 @@ ## grabN -Basis Function Combinator +Function \<{} \[cons\] times diff --git a/docs/reference/mkref/FuncRef.html b/docs/reference/mkref/FuncRef.html index 8625611..d4441b0 100644 --- a/docs/reference/mkref/FuncRef.html +++ b/docs/reference/mkref/FuncRef.html @@ -1055,9 +1055,8 @@ a F a
Compare the two items on the top of the stack for equality and replace them with a Boolean value.
a b eq
-------------
- Boolean
-Lorem ipsum.
+ Boolean + (a = b)-
Note that only one “level” of lists is flattened. In the example above [4] is not unquoted.
concat first first_two fourth getitem remove rest reverse rrest second shift shunt size sort split_at split_list swaack third zip
@@ -1106,7 +1105,7 @@ a F aBasis Function
Return the largest integer <= x.
-This function doesn’t make sense (yet) to have because there are (as yet) only integers in the system.
a b floordiv
------------------
(a/b)
-All the division commands need to be revisited when the “numeric tower” for Thun gets nailed down.
-
The basic parallelism combinator, the two programs are run independently.
Basis Function Combinator
-true [tuck mod dup 0 >] loop pop
-Gentzen diagram.
+Function
+Take two integers from the stack and replace them with their Greatest Common Denominator.
if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
++ ++
Euclid’s Algorithm
Basis Function Combinator
+Function
Compiled GCD function.
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+See gcd.
+Basis Function Combinator
-Same as a >= b.
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Basis Function
+Greater-than-or-equal-to comparison of two numbers.
+ a b ge
+--------------
+ Boolean
+ (a >= b)
+Basis Function Combinator
-General Recursion Combinator. :
-[if] [then] [rec1] [rec2] genrec
+Combinator
+General Recursion Combinator.
+ [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 whatever data parameters it needs. Fourth from the top is an if-part, followed by a then-part. If the if-part yields true, then the then-part is executed and the combinator terminates. The other two parameters are the rec1-part and the rec2-part. If the if-part yields false, the rec1-part is executed. Following that the four program parameters and the combinator are again pushed onto the stack bundled up in a quoted form. Then the rec2-part is executed, where it will find the bundled form. Typically it will then execute the bundled form, either with i or with app2, or some other combinator."
-The way to design one of these is to fix your base case [then] and the test [if], and then treat rec1 and rec2 as an else-part "sandwiching" a quotation of the whole function.
-For example, given a (general recursive) function 'F': :
+ [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte
++ ++
(Note that this definition includes the genrec symbol itself, it is self-referential. This is possible because the definition machinery does not check that symbols in defs are in the dictionary. genrec is the only self-referential definition.)
See the Recursion Combinators notebook.
+From “Recursion Theory and Joy” by Manfred von Thun:
+++“The genrec combinator takes four program parameters in addition to whatever data parameters it needs. Fourth from the top is an if-part, followed by a then-part. If the if-part yields true, then the then-part is executed and the combinator terminates. The other two parameters are the rec1-part and the rec2-part. If the if-part yields false, the rec1-part is executed. Following that the four program parameters and the combinator are again pushed onto the stack bundled up in a quoted form. Then the rec2-part is executed, where it will find the bundled form. Typically it will then execute the bundled form, either with i or with app2, or some other combinator.”
+
The way to design one of these is to fix your base case [then] and the test [if], and then treat rec1 and rec2 as an else-part “sandwiching” a quotation of the whole function.
For example, given a (general recursive) function F:
F == [I] [T] [R1] [R2] genrec
-If the [I] if-part fails you must derive R1 and R2 from: :
+If the [I] if-part fails you must derive R1 and R2 from: :
... 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 genrec combinator turns into an ifte combinator with a quoted copy of the original definition in the else-part: :
+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 genrec combinator turns into an ifte combinator with a quoted copy of the original definition in the else-part:
F == [I] [T] [R1] [R2] genrec
== [I] [T] [R1 [F] R2] ifte
-Primitive recursive functions are those where R2 == i. :
+Tail recursive functions are those where R2 is the i combinator:
P == [I] [T] [R] tailrec
== [I] [T] [R [P] i] ifte
== [I] [T] [R P] ifte
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Basis Function Combinator
-getitem == drop first
-Expects an integer and a quote on the stack and returns the item at the nth position in the quote counting from 0. :
-[a b c d] 0 getitem
+Function
+Expects an integer and a quote on the stack and returns the item at the nth position in the quote counting from 0.
+Example
+ [a b c d] 2 getitem
-------------------------
- a
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+ c
++ ++
If the number isn’t a valid index into the quote getitem will cause some sort of problem (the exact nature of which is implementation-dependant.)
concat first first_two flatten fourth remove rest reverse rrest second shift shunt size sort split_at split_list swaack third zip
Basis Function Combinator
<{} [cons] times
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[stack popd] dip
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a > b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Accepts a quoted symbol on the top of the stack and prints its docs.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[sqr] ii + sqrt
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
[Q] i
-----------
Q
-combo(i, [list(P)|S], S, Ei, Eo) :- append(P, Ei, Eo).
-This is probably the fundamental combinator. You wind up using it in all kinds of places (for example, the x combinator can be defined as dup i.)
Basis Function Combinator
The identity function.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Has the effect of grabbing a copy of the stack on which to run the if-part using infra.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
... [a b c] [Q] infra
---------------------------
c b a Q [...] swaack
-swons swaack [i] dip swaack
-This is one of the more useful combinators. It allows a quoted expression to serve as a stack for a program, effectively running it in a kind of “pocket universe”. If the list represents a datastructure then infra lets you work on its internal structure.
Basis Function Combinator
infra first
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
[sqr dup mul] inscribe
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a <= b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a << b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a < b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[codireco] ccons
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Run the quoted program on TOS on the items in the list under it, push a new list with the results in place of the program and original list.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Given a list find the maximum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Given a list find the minimum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a % b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a * b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a != b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as -a.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as not a.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
0 >=
Basis Function Combinator
[nullary] cons
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
... [P] nullary
---------------------
... A
-[stack] dip infra first
-... [P] nullary
... [P] [stack] dip infra first
... stack [P] infra first
... [...] [P] infra first
... [A ...] first
... A
-A very useful function that runs any other quoted function and returns it’s first result without disturbing the stack (under the quoted program.)
-Basis Function Combinator
swap at
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a | b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a2 a1 -- a2 a1 a2)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[i] map
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a1 --)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a2 a1 -- a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a3 a2 a1 -- a2 a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a2 a1 --)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a3 a2 a1 -- a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a4 a3 a2 a1 -- a2 a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
pop popop
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a ** b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Decrement TOS.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
1 swap [*] step
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[unit] dip
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[0 <=] [1 - dup] anamorphism
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
unit [down_to_zero] infra
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
rest cons
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
([a1 ...0] -- [...0])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Reverse the list on the top of the stack. :
reverse == [] swap shunt
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a1 a2 a3 -- a2 a3 a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a1 a2 a3 -- a3 a1 a2)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Round a number to a given precision in decimal digits.
The return value is an integer if ndigits is omitted or None. Otherwise the return value has the same type as the number. ndigits may be negative.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
([a1 a2 ...1] -- [...1])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a >> b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
<{} infra
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
([a1 a2 ...1] -- a2)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
The sequence can contain more than two items but not fewer. Currently Python semantics are used to evaluate the "truthiness" of the Boolean value (so empty string, zero, etc. are counted as false, etc.)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Print redistribution information.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
uncons [swons] dip
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[pop ++] step_zero
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Given a list return it sorted.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[drop] [take] clop
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[take reverse] [drop] clop
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
dup *
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Return the square root of the number a. Negative numbers return complex roots.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(... -- ... [...])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[stack] dip
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
The step combinator executes the quotation on each member of the list on top of the stack.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
0 roll> step
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(... a1 -- ... a1 a1 [...])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(... a2 a1 -- ... a2 a1 a1 a2 [...])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Same as a - b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Increment TOS.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Given a quoted sequence of numbers return the sum. :
sum == 0 swap [+] step
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
([...1] -- [...0])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a1 a2 -- a2 a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[swap] dip
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
swap concat
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
([...1] a1 -- [a1 ...1])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[i] genrec
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
... z y x [P] unary
-------------------------
... A
-binary popd
-Runs any other quoted function and returns its first result while consuming exactly three items from the stack.
-Basis Function Combinator
([a1 a2 a3 ...1] -- a3)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a2 a1 -- a1 a2 a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
... x [P] unary
---------------------
... A
-nullary popd
-Runs any other quoted function and returns its first result while consuming exactly one item from the stack.
- [A ...] uncons
--------------------
A [...]
-func(uncons, Si, So) :- func(cons, So, Si).
-This is the inverse of cons.
Basis Function Combinator
Given a list remove duplicate items.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
(a1 -- [a1 ])
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
[i] dip
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
([a1 ...1] -- [...1] a1)
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
True if the form on TOS is void otherwise False.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Print warranty information.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
swap nulco dupdipd concat loop
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Print all the words in alphabetical order.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
[F] x
-----------
[F] F
-dup i
-The x combinator …
Basis Function Combinator
Same as a ^ b.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
Basis Function Combinator
Replace the two lists on the top of the stack with a list of the pairs from each list. The smallest list sets the length of the result list.
Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.