Q, R's and some S's.
This commit is contained in:
parent
4613d6a0a8
commit
dd7374ef81
File diff suppressed because it is too large
Load Diff
|
|
@ -2807,121 +2807,109 @@ Or,
|
||||||
|
|
||||||
## quoted
|
## quoted
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[unit\] dip
|
"Quote D" Wrap the second item on the stack in a list.
|
||||||
|
|
||||||
Gentzen diagram.
|
a b quoted
|
||||||
|
----------------
|
||||||
|
[a] b
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[unit]\] [dip]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This comes from the original Joy stuff.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[unit]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## range
|
## range
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[0 \<=\] \[1 - dup\] anamorphism
|
Expect a number `n` on the stack and replace it with a list:
|
||||||
|
`[(n-1)...0]`.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
5 range
|
||||||
|
-----------------
|
||||||
|
[4 3 2 1 0]
|
||||||
|
|
||||||
|
-5 range
|
||||||
|
--------------
|
||||||
|
[]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[0 \<=\] \[1 - [dup]\] [anamorphism]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
If `n` is less than 1 the resulting list is empty.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[range_to_zero]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## range_to_zero
|
## range_to_zero
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
unit \[down_to_zero\] infra
|
Take a number `n` from the stack and replace it with a list
|
||||||
|
`[0...n]`.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
5 range_to_zero
|
||||||
|
---------------------
|
||||||
|
[0 1 2 3 4 5]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [unit] \[[down_to_zero]\] [infra]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Note that the order is reversed compared to [range].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[down_to_zero]
|
||||||
|
[range]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## reco
|
## reco
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
rest cons
|
Replace the first item in a list with the item under it.
|
||||||
|
|
||||||
Gentzen diagram.
|
a [b ...] reco
|
||||||
|
--------------------
|
||||||
|
[a ...]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [rest] [cons]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[codireco]
|
||||||
|
[make_generator]
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
@ -2941,159 +2929,93 @@ See [mod](#mod).
|
||||||
|
|
||||||
## remove
|
## remove
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Expects an item on the stack and a quote under it and removes that item
|
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
|
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. :
|
or the item isn't in the list then the list is unchanged.
|
||||||
|
|
||||||
[1 2 3 1] 1 remove
|
[1 2 3 1] 1 remove
|
||||||
------------------------
|
------------------------
|
||||||
[2 3 1]
|
[2 3 1]
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
See the ["Remove Function" notebook](https://osdn.net/projects/joypy/scm/git/Thun/blobs/master/docs/notebooks/Remove-Function.ipynb).
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## rest
|
## rest
|
||||||
|
|
||||||
Basis Function Combinator
|
Basis Function
|
||||||
|
|
||||||
([a1 ...0] -- [...0])
|
[a ...] rest
|
||||||
|
------------------
|
||||||
Gentzen diagram.
|
[...]
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[first]
|
||||||
|
[uncons]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## reverse
|
## reverse
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Reverse the list on the top of the stack. :
|
Reverse the list on the top of the stack.
|
||||||
|
|
||||||
reverse == [] swap shunt
|
### Example
|
||||||
|
|
||||||
Gentzen diagram.
|
[1 2 3] reverse
|
||||||
|
---------------------
|
||||||
|
[3 2 1]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [\<\{\}] [shunt]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## rolldown
|
## rolldown
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
(a1 a2 a3 -- a2 a3 a1)
|
a b c rolldown
|
||||||
|
--------------------
|
||||||
Gentzen diagram.
|
b c a
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [swapd] [swap]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[rollup]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## rollup
|
## rollup
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
(a1 a2 a3 -- a3 a1 a2)
|
a b c rollup
|
||||||
|
------------------
|
||||||
Gentzen diagram.
|
c a b
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [swap] [swapd]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[rolldown]
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
@ -3113,65 +3035,33 @@ See [rolldown](#rolldown).
|
||||||
|
|
||||||
## round
|
## round
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Round a number to a given precision in decimal digits.
|
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.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Another one that won't make sense until the "numeric tower" is nailed
|
||||||
|
down.
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## rrest
|
## rrest
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
([a1 a2 ...1] -- [...1])
|
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
|
[a b ...] rrest
|
||||||
|
---------------------
|
||||||
|
[...]
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [rest] [rest]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[rest]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -3193,352 +3083,242 @@ Basis Function
|
||||||
|
|
||||||
## run
|
## run
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\<{} infra
|
Run a quoted program in a list.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[1 2 +] run
|
||||||
|
-----------------
|
||||||
|
[3]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [\<\{\}] [infra]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## second
|
## second
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
([a1 a2 ...1] -- a2)
|
[a b ...] second
|
||||||
|
----------------------
|
||||||
Gentzen diagram.
|
b
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [rest] [first]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[first]
|
||||||
|
[third]
|
||||||
|
[fourth]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## select
|
## select
|
||||||
|
|
||||||
Basis Function Combinator
|
Basis Function
|
||||||
|
|
||||||
Use a Boolean value to select one of two items from a sequence. :
|
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
|
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
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
The sequence can contain more than two items but not fewer.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[choice]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## sharing
|
## sharing
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Print redistribution information.
|
Print redistribution information.
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Mathematically this is a form of [id], but it has the side-effect of
|
||||||
|
printing out the GPL notice.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[warranty]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## shift
|
## shift
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
uncons \[swons\] dip
|
Move the top item from one list to another.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[x y z] [a b c] shift
|
||||||
|
---------------------------
|
||||||
|
[a x y z] [b c]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [uncons] \[[swons]\] [dip]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[shunt]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## shunt
|
## shunt
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Like concat but reverses the top list into the second. :
|
Like [concat] but [reverse] the top list into the second.
|
||||||
|
|
||||||
shunt == [swons] step == reverse swap concat
|
### Example
|
||||||
|
|
||||||
[a b c] [d e f] shunt
|
[a b c] [d e f] shunt
|
||||||
---------------------------
|
---------------------------
|
||||||
[f e d a b c]
|
[f e d a b c]
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[swons]\] [step]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This is more efficient than [concat] so prefer it if you don't need to
|
||||||
|
preserve order.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[concat]
|
||||||
|
[reverse]
|
||||||
|
[shift]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## size
|
## size
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[pop ++\] step_zero
|
Replace a list with its size.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[23 [cats] 4] size
|
||||||
|
------------------------
|
||||||
|
3
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[pop] [++]\] [step_zero]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## sort
|
## sort
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Given a list return it sorted.
|
Given a list return it sorted.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
### Definition
|
[4 2 5 7 1] sort
|
||||||
|
----------------------
|
||||||
|
[1 2 4 5 7]
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## spiral_next
|
## spiral_next
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[\[\[abs\] ii \<=\] \[\[\<\>\] \[pop !-\] \|\|\] &&\] \[\[!-\]
|
Example code.
|
||||||
\[\[++\]\] \[\[\--\]\] ifte dip\] \[\[pop !-\] \[\--\] \[++\] ifte\]
|
|
||||||
ifte
|
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
See the ["Square Spiral Example Joy Code" notebook](https://joypy.osdn.io/notebooks/Square_Spiral.html).
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## split_at
|
## split_at
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[drop\] \[take\] clop
|
Split a list (second on the stack) at the position given by the number on
|
||||||
|
the top of the stack.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[1 2 3 4 5 6 7] 4 split_at
|
||||||
|
--------------------------------
|
||||||
|
[5 6 7] [4 3 2 1]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[drop]\] \[[take]\] [clop]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
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
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[split_list]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## split_list
|
## split_list
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[take reverse\] \[drop\] clop
|
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.
|
||||||
|
|
||||||
Gentzen diagram.
|
[1 2 3 4 5 6 7] 4 split_list
|
||||||
|
----------------------------------
|
||||||
|
[1 2 3 4] [5 6 7]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[take] [reverse]\] \[[drop]\] [clop]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Compare with [split_at]. This function does extra work to ensure that
|
||||||
|
[concat] would reconstruct the original list.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[split_at]
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,23 @@
|
||||||
|
|
||||||
## quoted
|
## quoted
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[unit\] dip
|
"Quote D" Wrap the second item on the stack in a list.
|
||||||
|
|
||||||
Gentzen diagram.
|
a b quoted
|
||||||
|
----------------
|
||||||
|
[a] b
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[unit]\] [dip]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This comes from the original Joy stuff.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[unit]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,30 @@
|
||||||
|
|
||||||
## range
|
## range
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[0 \<=\] \[1 - dup\] anamorphism
|
Expect a number `n` on the stack and replace it with a list:
|
||||||
|
`[(n-1)...0]`.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
5 range
|
||||||
|
-----------------
|
||||||
|
[4 3 2 1 0]
|
||||||
|
|
||||||
|
-5 range
|
||||||
|
--------------
|
||||||
|
[]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[0 \<=\] \[1 - [dup]\] [anamorphism]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
If `n` is less than 1 the resulting list is empty.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[range_to_zero]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,27 @@
|
||||||
|
|
||||||
## range_to_zero
|
## range_to_zero
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
unit \[down_to_zero\] infra
|
Take a number `n` from the stack and replace it with a list
|
||||||
|
`[0...n]`.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
5 range_to_zero
|
||||||
|
---------------------
|
||||||
|
[0 1 2 3 4 5]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [unit] \[[down_to_zero]\] [infra]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Note that the order is reversed compared to [range].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[down_to_zero]
|
||||||
|
[range]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,20 @@
|
||||||
|
|
||||||
## reco
|
## reco
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
rest cons
|
Replace the first item in a list with the item under it.
|
||||||
|
|
||||||
Gentzen diagram.
|
a [b ...] reco
|
||||||
|
--------------------
|
||||||
|
[a ...]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [rest] [cons]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[codireco]
|
||||||
|
[make_generator]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,34 +2,17 @@
|
||||||
|
|
||||||
## remove
|
## remove
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Expects an item on the stack and a quote under it and removes that item
|
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
|
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. :
|
or the item isn't in the list then the list is unchanged.
|
||||||
|
|
||||||
[1 2 3 1] 1 remove
|
[1 2 3 1] 1 remove
|
||||||
------------------------
|
------------------------
|
||||||
[2 3 1]
|
[2 3 1]
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
See the ["Remove Function" notebook](https://osdn.net/projects/joypy/scm/git/Thun/blobs/master/docs/notebooks/Remove-Function.ipynb).
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,14 @@
|
||||||
|
|
||||||
## rest
|
## rest
|
||||||
|
|
||||||
Basis Function Combinator
|
Basis Function
|
||||||
|
|
||||||
([a1 ...0] -- [...0])
|
[a ...] rest
|
||||||
|
------------------
|
||||||
Gentzen diagram.
|
[...]
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[first]
|
||||||
|
[uncons]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,17 @@
|
||||||
|
|
||||||
## reverse
|
## reverse
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Reverse the list on the top of the stack. :
|
Reverse the list on the top of the stack.
|
||||||
|
|
||||||
reverse == [] swap shunt
|
### Example
|
||||||
|
|
||||||
Gentzen diagram.
|
[1 2 3] reverse
|
||||||
|
---------------------
|
||||||
|
[3 2 1]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [\<\{\}] [shunt]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,17 @@
|
||||||
|
|
||||||
## rolldown
|
## rolldown
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
(a1 a2 a3 -- a2 a3 a1)
|
a b c rolldown
|
||||||
|
--------------------
|
||||||
Gentzen diagram.
|
b c a
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [swapd] [swap]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[rollup]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,17 @@
|
||||||
|
|
||||||
## rollup
|
## rollup
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
(a1 a2 a3 -- a3 a1 a2)
|
a b c rollup
|
||||||
|
------------------
|
||||||
Gentzen diagram.
|
c a b
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [swap] [swapd]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[rolldown]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,12 @@
|
||||||
|
|
||||||
## round
|
## round
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Round a number to a given precision in decimal digits.
|
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.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Another one that won't make sense until the "numeric tower" is nailed
|
||||||
|
down.
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,16 @@
|
||||||
|
|
||||||
## rrest
|
## rrest
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
([a1 a2 ...1] -- [...1])
|
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
|
[a b ...] rrest
|
||||||
|
---------------------
|
||||||
|
[...]
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [rest] [rest]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[rest]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,17 @@
|
||||||
|
|
||||||
## run
|
## run
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\<{} infra
|
Run a quoted program in a list.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[1 2 +] run
|
||||||
|
-----------------
|
||||||
|
[3]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [\<\{\}] [infra]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,19 @@
|
||||||
|
|
||||||
## second
|
## second
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
([a1 a2 ...1] -- a2)
|
[a b ...] second
|
||||||
|
----------------------
|
||||||
Gentzen diagram.
|
b
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [rest] [first]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[first]
|
||||||
|
[third]
|
||||||
|
[fourth]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,41 +2,23 @@
|
||||||
|
|
||||||
## select
|
## select
|
||||||
|
|
||||||
Basis Function Combinator
|
Basis Function
|
||||||
|
|
||||||
Use a Boolean value to select one of two items from a sequence. :
|
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
|
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
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
The sequence can contain more than two items but not fewer.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[choice]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,16 @@
|
||||||
|
|
||||||
## sharing
|
## sharing
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Print redistribution information.
|
Print redistribution information.
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Mathematically this is a form of [id], but it has the side-effect of
|
||||||
|
printing out the GPL notice.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[warranty]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,21 @@
|
||||||
|
|
||||||
## shift
|
## shift
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
uncons \[swons\] dip
|
Move the top item from one list to another.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[x y z] [a b c] shift
|
||||||
|
---------------------------
|
||||||
|
[a x y z] [b c]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [uncons] \[[swons]\] [dip]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[shunt]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,34 +2,28 @@
|
||||||
|
|
||||||
## shunt
|
## shunt
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Like concat but reverses the top list into the second. :
|
Like [concat] but [reverse] the top list into the second.
|
||||||
|
|
||||||
shunt == [swons] step == reverse swap concat
|
### Example
|
||||||
|
|
||||||
[a b c] [d e f] shunt
|
[a b c] [d e f] shunt
|
||||||
---------------------------
|
---------------------------
|
||||||
[f e d a b c]
|
[f e d a b c]
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[swons]\] [step]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This is more efficient than [concat] so prefer it if you don't need to
|
||||||
|
preserve order.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[concat]
|
||||||
|
[reverse]
|
||||||
|
[shift]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,17 @@
|
||||||
|
|
||||||
## size
|
## size
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[pop ++\] step_zero
|
Replace a list with its size.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[23 [cats] 4] size
|
||||||
|
------------------------
|
||||||
|
3
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[pop] [++]\] [step_zero]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,13 @@
|
||||||
|
|
||||||
## sort
|
## sort
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
Given a list return it sorted.
|
Given a list return it sorted.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
### Definition
|
[4 2 5 7 1] sort
|
||||||
|
----------------------
|
||||||
|
[1 2 4 5 7]
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,11 @@
|
||||||
|
|
||||||
## spiral_next
|
## spiral_next
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[\[\[abs\] ii \<=\] \[\[\<\>\] \[pop !-\] \|\|\] &&\] \[\[!-\]
|
Example code.
|
||||||
\[\[++\]\] \[\[\--\]\] ifte dip\] \[\[pop !-\] \[\--\] \[++\] ifte\]
|
|
||||||
ifte
|
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
See the ["Square Spiral Example Joy Code" notebook](https://joypy.osdn.io/notebooks/Square_Spiral.html).
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,28 @@
|
||||||
|
|
||||||
## split_at
|
## split_at
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[drop\] \[take\] clop
|
Split a list (second on the stack) at the position given by the number on
|
||||||
|
the top of the stack.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
[1 2 3 4 5 6 7] 4 split_at
|
||||||
|
--------------------------------
|
||||||
|
[5 6 7] [4 3 2 1]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[drop]\] \[[take]\] [clop]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
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
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[split_list]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,26 @@
|
||||||
|
|
||||||
## split_list
|
## split_list
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[take reverse\] \[drop\] clop
|
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.
|
||||||
|
|
||||||
Gentzen diagram.
|
[1 2 3 4 5 6 7] 4 split_list
|
||||||
|
----------------------------------
|
||||||
|
[1 2 3 4] [5 6 7]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[take] [reverse]\] \[[drop]\] [clop]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Compare with [split_at]. This function does extra work to ensure that
|
||||||
|
[concat] would reconstruct the original list.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[split_at]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,15 @@
|
||||||
|
|
||||||
## sqr
|
## sqr
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
dup \*
|
Square the number on the top of the stack.
|
||||||
|
|
||||||
Gentzen diagram.
|
n sqr
|
||||||
|
------------
|
||||||
|
n²
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> [dup] [mul]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -7,24 +7,7 @@ Basis Function Combinator
|
||||||
Return the square root of the number a. Negative numbers return complex
|
Return the square root of the number a. Negative numbers return complex
|
||||||
roots.
|
roots.
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Another "numeric tower" hatch...
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,26 @@
|
||||||
|
|
||||||
## stack
|
## stack
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
(... -- ... [...])
|
Put the stack onto the stack.
|
||||||
|
|
||||||
Gentzen diagram.
|
... c b a stack
|
||||||
|
---------------------------
|
||||||
|
... c b a [a b c ...]
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[\] [swaack] [dup] [swaack] [first]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This function forms a pair with [unstack], and together they form the
|
||||||
|
complement to the "destructive" pair [enstacken] and [disenstacken].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[unstack]
|
||||||
|
[enstacken]
|
||||||
|
[disenstacken]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,17 @@
|
||||||
|
|
||||||
## stackd
|
## stackd
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[stack\] dip
|
Grab the stack under the top item and put it onto the stack.
|
||||||
|
|
||||||
Gentzen diagram.
|
### Example
|
||||||
|
|
||||||
|
... 1 2 3 stackd
|
||||||
|
------------------------
|
||||||
|
... 1 2 [2 1 ...] 3
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[stack]\] [dip]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
### Crosslinks
|
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
|
|
@ -2,45 +2,29 @@
|
||||||
|
|
||||||
## step
|
## step
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
Run a quoted program on each item in a sequence. :
|
Run a quoted program on each item in a sequence.
|
||||||
|
|
||||||
... [] [Q] . step
|
... [] [Q] step
|
||||||
-----------------------
|
---------------------
|
||||||
... .
|
...
|
||||||
|
|
||||||
|
|
||||||
... [a] [Q] . step
|
... [a] [Q] step
|
||||||
------------------------
|
----------------------
|
||||||
... a . Q
|
... 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.
|
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html).
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[step_zero]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## step_zero
|
## step_zero
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
0 roll> step
|
0 roll> step
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue