Got through the A's.
This commit is contained in:
parent
b13832b792
commit
e9a5fbdb51
|
|
@ -8,5 +8,5 @@ Return the absolute value of the argument.
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
> \[0 <\] \[0 [swap](#swap) -\] \[\] [ifte](#ifte)
|
> [dup](#dup) 0 < [] \[[neg](#neg)\] [branch](#branch)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ Basis Function
|
||||||
|
|
||||||
Logical bit-wise AND.
|
Logical bit-wise AND.
|
||||||
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[or](#or)
|
||||||
|
[xor](#xor)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
"apply one"
|
"apply one"
|
||||||
|
|
||||||
(Combinator)
|
Combinator
|
||||||
|
|
||||||
Given a quoted program on TOS and anything as the second stack item run
|
Given a quoted program on TOS and anything as the second stack item run
|
||||||
the program without disturbing the stack and replace the two args with
|
the program without disturbing the stack and replace the two args with
|
||||||
|
|
@ -14,13 +14,21 @@ the first result of the program.
|
||||||
---------------------------------
|
---------------------------------
|
||||||
... [x ...] [Q] infra first
|
... [x ...] [Q] infra first
|
||||||
|
|
||||||
|
This is the same effect as the [unary](#unary) combinator.
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
nullary popd
|
> [nullary](#nullary) [popd](#popd)
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Just a specialization of `nullary` really. Its parallelizable cousins
|
Just a specialization of `nullary` really. Its parallelizable cousins
|
||||||
are more useful.
|
are more useful.
|
||||||
|
|
||||||
|
### Crosslinks
|
||||||
|
|
||||||
|
[app2](#app2)
|
||||||
|
[app3](#app3)
|
||||||
|
[appN](#appN)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,33 +2,35 @@
|
||||||
|
|
||||||
## app2
|
## app2
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
Like app1 with two items.
|
Like [app1](#app1) with two items.
|
||||||
|
|
||||||
: ... y x [Q] . app2
|
... y x [Q] . app2
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
... [y ...] [Q] . infra first
|
... [y ...] [Q] . infra first
|
||||||
[x ...] [Q] infra first
|
[x ...] [Q] infra first
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[grba] [swap] [grba] [swap]\] [dip] \[[infrst]\] [cons] [ii]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Unlike [app1](#app1), which is essentially an alias for [unary](#unary),
|
||||||
|
this function is not the same as [binary](#binary). Instead of running
|
||||||
|
one program using exactly two items from the stack and pushing one
|
||||||
|
result (as [binary](#binary) does) this function takes two items from the
|
||||||
|
stack and runs the program twice, separately for each of the items, then
|
||||||
|
puts both results onto the stack.
|
||||||
|
|
||||||
|
This is not currently implemented as parallel processes but it can (and
|
||||||
|
should) be done.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[app1](#app1)
|
||||||
|
[app3](#app3)
|
||||||
|
[appN](#appN)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,34 +2,28 @@
|
||||||
|
|
||||||
## app3
|
## app3
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
Like app1 with three items.
|
Like [app1] with three items.
|
||||||
|
|
||||||
: ... z y x [Q] . app3
|
... z y x [Q] . app3
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
... [z ...] [Q] . infra first
|
... [z ...] [Q] . infra first
|
||||||
[y ...] [Q] infra first
|
[y ...] [Q] infra first
|
||||||
[x ...] [Q] infra first
|
[x ...] [Q] infra first
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> 3 [appN]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
See [app2].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[app1](#app1)
|
||||||
|
[app2](#app2)
|
||||||
|
[appN](#appN)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,31 @@
|
||||||
|
|
||||||
## appN
|
## appN
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
\[grabN\] codi map disenstacken
|
Like [app1] with any number of items.
|
||||||
|
|
||||||
Gentzen diagram.
|
... xN ... x2 x1 x0 [Q] n . appN
|
||||||
|
--------------------------------------
|
||||||
|
... [xN ...] [Q] . infra first
|
||||||
|
...
|
||||||
|
[x2 ...] [Q] infra first
|
||||||
|
[x1 ...] [Q] infra first
|
||||||
|
[x0 ...] [Q] infra first
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[grabN]\] [codi] [map] [disenstacken]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This function takes a quoted function `Q` and an integer and runs the
|
||||||
|
function that many times on that many stack items. See also [app2].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[app1](#app1)
|
||||||
|
[app2](#app2)
|
||||||
|
[app3](#app3)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,23 @@
|
||||||
|
|
||||||
## average
|
## average
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[sum\] \[size\] cleave /
|
Compute the average of a list of numbers.
|
||||||
|
(Currently broken until I can figure out what to do about "numeric tower"
|
||||||
Gentzen diagram.
|
in Thun.)
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[sum]\] \[[size]\] [cleave] [/]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Theoretically this function would compute the sum and the size in two
|
||||||
|
separate threads, then divide. This works but a compiled version would
|
||||||
|
probably do better to sum and count the list once, in one thread, eh?
|
||||||
|
|
||||||
### Crosslinks
|
As an exercise in Functional Programming in Joy it would be fun to
|
||||||
|
convert this into a catamorphism.
|
||||||
|
See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html).
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -338,7 +338,7 @@ Return the absolute value of the argument.
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
> \[0 <\] \[0 [swap](#swap) -\] \[\] [ifte](#ifte)
|
> [dup](#dup) 0 < [] \[[neg](#neg)\] [branch](#branch)
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
@ -386,10 +386,11 @@ Basis Function
|
||||||
|
|
||||||
Logical bit-wise AND.
|
Logical bit-wise AND.
|
||||||
|
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[or](#or)
|
||||||
|
[xor](#xor)
|
||||||
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
|
@ -397,7 +398,7 @@ Lorem ipsum.
|
||||||
|
|
||||||
"apply one"
|
"apply one"
|
||||||
|
|
||||||
(Combinator)
|
Combinator
|
||||||
|
|
||||||
Given a quoted program on TOS and anything as the second stack item run
|
Given a quoted program on TOS and anything as the second stack item run
|
||||||
the program without disturbing the stack and replace the two args with
|
the program without disturbing the stack and replace the two args with
|
||||||
|
|
@ -407,117 +408,124 @@ the first result of the program.
|
||||||
---------------------------------
|
---------------------------------
|
||||||
... [x ...] [Q] infra first
|
... [x ...] [Q] infra first
|
||||||
|
|
||||||
|
This is the same effect as the [unary](#unary) combinator.
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
nullary popd
|
> [nullary](#nullary) [popd](#popd)
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Just a specialization of `nullary` really. Its parallelizable cousins
|
Just a specialization of `nullary` really. Its parallelizable cousins
|
||||||
are more useful.
|
are more useful.
|
||||||
|
|
||||||
|
### Crosslinks
|
||||||
|
|
||||||
|
[app2](#app2)
|
||||||
|
[app3](#app3)
|
||||||
|
[appN](#appN)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## app2
|
## app2
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
Like app1 with two items.
|
Like [app1](#app1) with two items.
|
||||||
|
|
||||||
: ... y x [Q] . app2
|
... y x [Q] . app2
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
... [y ...] [Q] . infra first
|
... [y ...] [Q] . infra first
|
||||||
[x ...] [Q] infra first
|
[x ...] [Q] infra first
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[grba] [swap] [grba] [swap]\] [dip] \[[infrst]\] [cons] [ii]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Unlike [app1](#app1), which is essentially an alias for [unary](#unary),
|
||||||
|
this function is not the same as [binary](#binary). Instead of running
|
||||||
|
one program using exactly two items from the stack and pushing one
|
||||||
|
result (as [binary](#binary) does) this function takes two items from the
|
||||||
|
stack and runs the program twice, separately for each of the items, then
|
||||||
|
puts both results onto the stack.
|
||||||
|
|
||||||
|
This is not currently implemented as parallel processes but it can (and
|
||||||
|
should) be done.
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[app1](#app1)
|
||||||
|
[app3](#app3)
|
||||||
|
[appN](#appN)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## app3
|
## app3
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
Like app1 with three items.
|
Like [app1] with three items.
|
||||||
|
|
||||||
: ... z y x [Q] . app3
|
... z y x [Q] . app3
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
... [z ...] [Q] . infra first
|
... [z ...] [Q] . infra first
|
||||||
[y ...] [Q] infra first
|
[y ...] [Q] infra first
|
||||||
[x ...] [Q] infra first
|
[x ...] [Q] infra first
|
||||||
|
|
||||||
Gentzen diagram.
|
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> 3 [appN]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
See [app2].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[app1](#app1)
|
||||||
|
[app2](#app2)
|
||||||
|
[appN](#appN)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
## appN
|
## appN
|
||||||
|
|
||||||
Basis Function Combinator
|
Combinator
|
||||||
|
|
||||||
\[grabN\] codi map disenstacken
|
Like [app1] with any number of items.
|
||||||
|
|
||||||
Gentzen diagram.
|
... xN ... x2 x1 x0 [Q] n . appN
|
||||||
|
--------------------------------------
|
||||||
|
... [xN ...] [Q] . infra first
|
||||||
|
...
|
||||||
|
[x2 ...] [Q] infra first
|
||||||
|
[x1 ...] [Q] infra first
|
||||||
|
[x0 ...] [Q] infra first
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[grabN]\] [codi] [map] [disenstacken]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
This function takes a quoted function `Q` and an integer and runs the
|
||||||
|
function that many times on that many stack items. See also [app2].
|
||||||
|
|
||||||
### Crosslinks
|
### Crosslinks
|
||||||
|
|
||||||
Lorem ipsum.
|
[app1](#app1)
|
||||||
|
[app2](#app2)
|
||||||
|
[app3](#app3)
|
||||||
|
[unary](#unary)
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
@ -530,31 +538,26 @@ See [getitem](#getitem).
|
||||||
|
|
||||||
## average
|
## average
|
||||||
|
|
||||||
Basis Function Combinator
|
Function
|
||||||
|
|
||||||
\[sum\] \[size\] cleave /
|
Compute the average of a list of numbers.
|
||||||
|
(Currently broken until I can figure out what to do about "numeric tower"
|
||||||
Gentzen diagram.
|
in Thun.)
|
||||||
|
|
||||||
### Definition
|
### Definition
|
||||||
|
|
||||||
if not basis.
|
> \[[sum]\] \[[size]\] [cleave] [/]
|
||||||
|
|
||||||
### Derivation
|
|
||||||
|
|
||||||
if not basis.
|
|
||||||
|
|
||||||
### Source
|
|
||||||
|
|
||||||
if basis
|
|
||||||
|
|
||||||
### Discussion
|
### Discussion
|
||||||
|
|
||||||
Lorem ipsum.
|
Theoretically this function would compute the sum and the size in two
|
||||||
|
separate threads, then divide. This works but a compiled version would
|
||||||
|
probably do better to sum and count the list once, in one thread, eh?
|
||||||
|
|
||||||
### Crosslinks
|
As an exercise in Functional Programming in Joy it would be fun to
|
||||||
|
convert this into a catamorphism.
|
||||||
|
See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html).
|
||||||
|
|
||||||
Lorem ipsum.
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue