diff --git a/docs/reference/mkref/FuncRef.html b/docs/reference/mkref/FuncRef.html index 9d4e444..8a1cada 100644 --- a/docs/reference/mkref/FuncRef.html +++ b/docs/reference/mkref/FuncRef.html @@ -1792,64 +1792,68 @@ a F a
Basis Function Combinator
-[unit] dip
-Gentzen diagram.
+Function
+“Quote D” Wrap the second item on the stack in a list.
+ a b quoted
+----------------
+ [a] b
if not basis.
-if not basis.
-if basis
++ +
Lorem ipsum.
+This comes from the original Joy stuff.
Lorem ipsum.
+Basis Function Combinator
-[0 <=] [1 - dup] anamorphism
-Gentzen diagram.
+Function
+Expect a number n on the stack and replace it with a list: [(n-1)...0].
5 range
+-----------------
+ [4 3 2 1 0]
+
+ -5 range
+--------------
+ []
if not basis.
-if not basis.
-if basis
++[0 <=] [1 - dup] anamorphism
+
Lorem ipsum.
+If n is less than 1 the resulting list is empty.
Lorem ipsum.
+Basis Function Combinator
-unit [down_to_zero] infra
-Gentzen diagram.
+Function
+Take a number n from the stack and replace it with a list [0...n].
5 range_to_zero
+---------------------
+ [0 1 2 3 4 5]
if not basis.
-if not basis.
-if basis
++ +
Lorem ipsum.
+Note that the order is reversed compared to range.
Lorem ipsum.
+Basis Function Combinator
-rest cons
-Gentzen diagram.
+Function
+Replace the first item in a list with the item under it.
+ a [b ...] reco
+--------------------
+ [a ...]
if not basis.
-if not basis.
-if basis
-Lorem ipsum.
++ +
Lorem ipsum.
+See mod.
@@ -1858,83 +1862,57 @@ a F aSee mod.
Basis Function Combinator
-Expects an item on the stack and a quote under it and removes that item from the the quote. The item is only removed once. If the list is empty or the item isn't in the list then the list is unchanged. :
-[1 2 3 1] 1 remove
+Function
+Expects an item on the stack and a quote under it and removes that item from the the quote. The item is only removed once. If the list is empty or the item isn’t in the list then the list is unchanged.
+ [1 2 3 1] 1 remove
------------------------
- [2 3 1]
-Gentzen diagram.
+ [2 3 1]
if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+See the “Remove Function” notebook.
Basis Function Combinator
-([a1 ...0] -- [...0])
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Basis Function
+ [a ...] rest
+------------------
+ [...]
+Basis Function Combinator
-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.
+Function
+Reverse the list on the top of the stack.
+ [1 2 3] reverse
+---------------------
+ [3 2 1]
++ +
Basis Function Combinator
-(a1 a2 a3 -- a2 a3 a1)
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Function
+ a b c rolldown
+--------------------
+ b c a
++ ++
Basis Function Combinator
-(a1 a2 a3 -- a3 a1 a2)
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Function
+ a b c rollup
+------------------
+ c a b
++ ++
See rollup.
@@ -1943,35 +1921,22 @@ a F aSee rolldown.
Basis Function Combinator
+Function
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.
+Another one that won’t make sense until the “numeric tower” is nailed down.
Basis Function Combinator
-([a1 a2 ...1] -- [...1])
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Function
+ [a b ...] rrest
+---------------------
+ [...]
++ ++
Basis Function
@@ -1979,246 +1944,201 @@ a F a a n rshift
----------------
(a∕2ⁿ)
-Basis Function Combinator
-<{} infra
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Function
+Run a quoted program in a list.
+ [1 2 +] run
+-----------------
+ [3]
++ +
Basis Function Combinator
-([a1 a2 ...1] -- a2)
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Function
+ [a b ...] second
+----------------------
+ b
++ ++
Basis Function Combinator
+Basis Function
Use a Boolean value to select one of two items from a sequence. :
-[A B] false select
+ [a b] false select
------------------------
- A
+ a
-
-[A B] true select
+ [a b] true select
-----------------------
- B
-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.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+ b
+The sequence can contain more than two items but not fewer.
+Basis Function Combinator
+Function
Print redistribution information.
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Mathematically this is a form of id, but it has the side-effect of printing out the GPL notice.
+Basis Function Combinator
-uncons [swons] dip
-Gentzen diagram.
-if not basis.
-if not basis.
-if basis
-Lorem ipsum.
-Lorem ipsum.
+Function
+Move the top item from one list to another.
+ [x y z] [a b c] shift
+---------------------------
+ [a x y z] [b c]
++ ++
Basis Function Combinator
-Like concat but reverses the top list into the second. :
-shunt == [swons] step == reverse swap concat
-
- [a b c] [d e f] shunt
+Function
+Like concat but reverse the top list into the second.
+Example
+ [a b c] [d e f] shunt
---------------------------
[f e d a b c]
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+Definition
+
+
+
+Discussion
+This is more efficient than concat so prefer it if you don’t need to preserve order.
+Crosslinks
+
size
-Basis Function Combinator
-[pop ++] step_zero
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+Function
+Replace a list with its size.
+Example
+ [23 [cats] 4] size
+------------------------
+ 3
+Definition
+
+
+
sort
-Basis Function Combinator
+Function
Given a list return it sorted.
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+Example
+ [4 2 5 7 1] sort
+----------------------
+ [1 2 4 5 7]
spiral_next
-Basis Function Combinator
-[[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+Function
+Example code.
+Discussion
+See the “Square Spiral Example Joy Code” notebook.
split_at
-Basis Function Combinator
-[drop] [take] clop
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+Function
+Split a list (second on the stack) at the position given by the number on the top of the stack.
+Example
+ [1 2 3 4 5 6 7] 4 split_at
+--------------------------------
+ [5 6 7] [4 3 2 1]
+Definition
+
+
+
+Discussion
+Take a list and a number n from the stack, take n items from the top of the list and shunt them onto a new list that replaces the number n on the top of the stack.
+Crosslinks
+
split_list
-Basis Function Combinator
-[take reverse] [drop] clop
-Gentzen diagram.
-Definition
-if not basis.
-Derivation
-if not basis.
-Source
-if basis
-Discussion
-Lorem ipsum.
-Crosslinks
-Lorem ipsum.
+Function
+Split a list (second on the stack) at the position given by the number on the top of the stack such that concat would reconstruct the original list.
+ [1 2 3 4 5 6 7] 4 split_list
+----------------------------------
+ [1 2 3 4] [5 6 7]
+Definition
+
+
+
+Discussion
+Compare with split_at. This function does extra work to ensure that concat would reconstruct the original list.
+Crosslinks
+
sqr
Basis Function Combinator
dup *
Gentzen diagram.
-Definition
+Definition
if not basis.
-Derivation
+Derivation
if not basis.
-Source
+Source
if basis
-Discussion
+Discussion
Lorem ipsum.
-Crosslinks
+Crosslinks
Lorem ipsum.
sqrt
Basis Function Combinator
Return the square root of the number a. Negative numbers return complex roots.
Gentzen diagram.
-Definition
+Definition
if not basis.
-Derivation
+Derivation
if not basis.
-Source
+Source
if basis
-Discussion
+Discussion
Lorem ipsum.
-Crosslinks
+Crosslinks
Lorem ipsum.
stack
Basis Function Combinator
(... -- ... [...])
Gentzen diagram.
-Definition
+Definition
if not basis.
-Derivation
+Derivation
if not basis.
-Source
+Source
if basis
-Discussion
+Discussion
Lorem ipsum.
-Crosslinks
+Crosslinks
Lorem ipsum.
stackd
Basis Function Combinator
[stack] dip
Gentzen diagram.
-Definition
+Definition
if not basis.
-Derivation
+Derivation
if not basis.
-Source
+Source
if basis
-Discussion
+Discussion
Lorem ipsum.
-Crosslinks
+Crosslinks
Lorem ipsum.
step
@@ -2239,90 +2159,90 @@ a F a
... a . Q [b c] [Q] step
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.