From: Simon Forman Date: Sun, 27 Mar 2022 20:04:42 +0000 (-0700) Subject: And there are the P's. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4613d6a0a8b00ab1e33e0564eca5761988906599;p=joypy%2FThun.git And there are the P's. --- diff --git a/docs/reference/mkref/FuncRef.html b/docs/reference/mkref/FuncRef.html index a827cc5..9d4e444 100644 --- a/docs/reference/mkref/FuncRef.html +++ b/docs/reference/mkref/FuncRef.html @@ -1622,276 +1622,233 @@ a F a

tuck


pam

-

Basis Function Combinator

-

[i] map

-

Gentzen diagram.

+

Combinator

+

Take a list of quoted functions from the stack and replace it with a list of the first results from running those functions (on copies of the rest of the stack.)

+

Example

+
   5 7 [[+][-][*][/][%]] pam
+-------------------------------
+      5 7 [12 -2 35 0 5]

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

+
+

[i] map

+

Discussion

-

Lorem ipsum.

+

A specialization of map that runs a list of functions in parallel (if the underlying map function is so implemented, of course.)

-

Lorem ipsum.

+

map


pick

See getitem.


pm

-

Basis Function Combinator

-

Plus or minus :

-
a b pm
--------------
-a+b a-b
-

Gentzen diagram.

+

Function

+

Plus or minus. Replace two numbers with their sum and difference.

+
      a b pm
+-----------------
+   (a+b) (a-b)

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+
+

[+] [-] clop

+

pop

-

Basis Function Combinator

-
(a1 --)
-

Gentzen diagram.

+

Basis Function

+

Pop the top item from the stack and discard it.

+
   a pop
+-----------
+ +

popd popdd popop popopd popopdd popopop

+
+

popd

+

Function

+

pop the second item down on the stack.

+
   a b popd
+--------------
+      b

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

swap pop

+
-

Lorem ipsum.

+

pop popdd popop popopd popopdd popopop


-

popd

-

Basis Function Combinator

-
(a2 a1 -- a1)
-

Gentzen diagram.

+

popdd

+

Function

+

pop the third item on the stack.

+
   a b c popdd
+-----------------
+       b c

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

rolldown pop

+
-

Lorem ipsum.

+

pop popd popop popopd popopdd popopop


-

popdd

-

Basis Function Combinator

-
(a3 a2 a1 -- a2 a1)
-

Gentzen diagram.

+

popop

+

Function

+

pop two items from the stack.

+
   a b popop
+---------------

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

pop pop

+
-

Lorem ipsum.

+

pop popd popdd popopd popopdd popopop


-

popop

-

Basis Function Combinator

-
(a2 a1 --)
-

Gentzen diagram.

+

popopd

+

Function

+

pop the second and third items from the stack.

+
   a b c popopd
+------------------
+        c

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

rollup popop

+
-

Lorem ipsum.

+

pop popd popdd popop popopdd popopop


-

popopd

-

Basis Function Combinator

-
(a3 a2 a1 -- a1)
-

Gentzen diagram.

+

popopdd

+

Function

+
   a b c d popopdd
+---------------------
+        c d

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

[popop] dipd

+
-

Lorem ipsum.

+

pop popd popdd popop popopd popopop


-

popopdd

-

Basis Function Combinator

-
(a4 a3 a2 a1 -- a2 a1)
-

Gentzen diagram.

+

popopop

+

Function

+

pop three items from the stack.

+
   a b c popopop
+-------------------

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

pop popop

+
-

Lorem ipsum.

-
-

popopop

-

Basis Function Combinator

-

pop popop

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

pop popd popdd popop popopd popopdd


pow

-

Basis Function Combinator

-

Same as a ** b.

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Basis Function

+

Take two numbers a and b from the stack and raise a to the nth power. (b is on the top of the stack.)

+
   a n pow
+-------------
+    (aⁿ)
+

Example

+
   2 [2 3 4 5 6 7 8 9] [pow] map
+-----------------------------------
+    2 [4 8 16 32 64 128 256 512]

pred

-

Basis Function Combinator

-

Decrement TOS.

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Predecessor. Decrement TOS.

+

Definition

+
+

1 -

+
+ +

succ


primrec

-

Basis Function Combinator

-

From the "Overview of the language JOY":

-

> The primrec combinator expects two quoted programs in addition to a data parameter. For an integer data parameter it works like this: If the data parameter is zero, then the first quotation has to produce the value to be returned. If the data parameter is positive then the second has to combine the data parameter with the result of applying the function to its predecessor.:

-
5  [1]  [*]  primrec
-

> Then primrec tests whether the top element on the stack (initially the 5) is equal to zero. If it is, it pops it off and executes one of the quotations, the [1] which leaves 1 on the stack as the result. Otherwise it pushes a decremented copy of the top element and recurses. On the way back from the recursion it uses the other quotation, [*], to multiply what is now a factorial on top of the stack by the second element on the stack.:

-
n [Base] [Recur] primrec
-
-   0 [Base] [Recur] primrec
+

Combinator

+

From the “Overview of the language JOY”

+
+

The primrec combinator expects two quoted programs in addition to a data parameter. For an integer data parameter it works like this: If the data parameter is zero, then the first quotation has to produce the value to be returned. If the data parameter is positive then the second has to combine the data parameter with the result of applying the function to its predecessor.

+
+
+

5 [1] [*] primrec

+
+
+

Then primrec tests whether the top element on the stack (initially the 5) is equal to zero. If it is, it pops it off and executes one of the quotations, the [1] which leaves 1 on the stack as the result. Otherwise it pushes a decremented copy of the top element and recurses. On the way back from the recursion it uses the other quotation, [*], to multiply what is now a factorial on top of the stack by the second element on the stack.

+
+
   0 [Base] [Recur] primrec
 ------------------------------
       Base
 
-     n [Base] [Recur] primrec
+         n [Base] [Recur] primrec
 ------------------------------------------ n > 0
    n (n-1) [Base] [Recur] primrec Recur
-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Discussion

+

Simple and useful specialization of the genrec combinator from the original Joy system.

+ +

genrec tailrec


product

-

Basis Function Combinator

-

1 swap [*] step

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Just as sum sums a list of numbers, this function multiplies them together.

+

Definition

+
+

1 swap [mul] step

+
+

Or,

+
+

[1] [mul] primrec

+

quoted

Basis Function Combinator

[unit] dip

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


range

Basis Function Combinator

[0 <=] [1 - dup] anamorphism

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


range_to_zero

Basis Function Combinator

unit [down_to_zero] infra

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


reco

Basis Function Combinator

rest cons

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


rem

@@ -1907,30 +1864,30 @@ a+b a-b
------------------------ [2 3 1]

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


rest

Basis Function Combinator

([a1 ...0] -- [...0])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


reverse

@@ -1938,45 +1895,45 @@ a+b a-b

Reverse the list on the top of the stack. :

reverse == [] swap shunt

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


rolldown

Basis Function Combinator

(a1 a2 a3 -- a2 a3 a1)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


rollup

Basis Function Combinator

(a1 a2 a3 -- a3 a1 a2)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


roll>

@@ -1990,30 +1947,30 @@ a+b a-b

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

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


rrest

Basis Function Combinator

([a1 a2 ...1] -- [...1])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


rshift

@@ -2022,37 +1979,37 @@ a+b a-b
   a n rshift
 ----------------
      (a∕2ⁿ)
- +

lshift


run

Basis Function Combinator

<{} infra

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


second

Basis Function Combinator

([a1 a2 ...1] -- a2)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


select

@@ -2068,45 +2025,45 @@ a+b a-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

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


sharing

Basis Function Combinator

Print redistribution information.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


shift

Basis Function Combinator

uncons [swons] dip

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


shunt

@@ -2118,150 +2075,150 @@ a+b a-b --------------------------- [f e d a b c]

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


size

Basis Function Combinator

[pop ++] step_zero

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


sort

Basis Function Combinator

Given a list return it sorted.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


spiral_next

Basis Function Combinator

[[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


split_at

Basis Function Combinator

[drop] [take] clop

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


split_list

Basis Function Combinator

[take reverse] [drop] clop

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


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.

- +

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.

- +

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.

- +

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.

- +

Lorem ipsum.


step

@@ -2282,90 +2239,90 @@ a+b a-b ... 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

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


step_zero

Basis Function Combinator

0 roll> step

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


stuncons

Basis Function Combinator

(... a1 -- ... a1 a1 [...])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


stununcons

Basis Function Combinator

(... a2 a1 -- ... a2 a1 a1 a2 [...])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


sub

Basis Function Combinator

Same as a - b.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


succ

Basis Function Combinator

Increment TOS.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


sum

@@ -2373,105 +2330,105 @@ a+b a-b

Given a quoted sequence of numbers return the sum. :

sum == 0 swap [+] step

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


swaack

Basis Function Combinator

([...1] -- [...0])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


swap

Basis Function Combinator

(a1 a2 -- a2 a1)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


swapd

Basis Function Combinator

[swap] dip

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


swoncat

Basis Function Combinator

swap concat

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


swons

Basis Function Combinator

([...1] a1 -- [a1 ...1])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


tailrec

Basis Function Combinator

[i] genrec

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


take

@@ -2481,15 +2438,15 @@ a+b a-b ---------------------- [b a]

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


ternary

@@ -2498,26 +2455,26 @@ a+b a-b
   ... z y x [P] unary
 -------------------------
          ... A
-

Definition

+

Definition

binary popd
-

Discussion

+

Discussion

Runs any other quoted function and returns its first result while consuming exactly three items from the stack.

- +

binary nullary unary


third

Basis Function Combinator

([a1 a2 a3 ...1] -- a3)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


times

@@ -2537,15 +2494,15 @@ a+b a-b ------------------------------------- w/ n > 1 ... . Q (n - 1) [Q] times

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


truthy

@@ -2555,15 +2512,15 @@ a+b a-b

Basis Function Combinator

(a2 a1 -- a1 a2 a1)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


unary

@@ -2572,11 +2529,11 @@ a+b a-b
   ... x [P] unary
 ---------------------
        ... A
-

Definition

+

Definition

nullary popd
-

Discussion

+

Discussion

Runs any other quoted function and returns its first result while consuming exactly one item from the stack.

- +

binary nullary ternary


uncons

@@ -2585,131 +2542,131 @@ a+b a-b
   [A ...] uncons
 --------------------
       A [...]
-

Source

+

Source

func(uncons, Si, So) :- func(cons, So, Si).
-

Discussion

+

Discussion

This is the inverse of cons.

- +

cons


unique

Basis Function Combinator

Given a list remove duplicate items.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


unit

Basis Function Combinator

(a1 -- [a1 ])

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


unquoted

Basis Function Combinator

[i] dip

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


unswons

Basis Function Combinator

([a1 ...1] -- [...1] a1)

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


void

Basis Function Combinator

True if the form on TOS is void otherwise False.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


warranty

Basis Function Combinator

Print warranty information.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


while

Basis Function Combinator

swap nulco dupdipd concat loop

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


words

Basis Function Combinator

Print all the words in alphabetical order.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


x

@@ -2717,39 +2674,39 @@ a+b a-b
   [F] x
 -----------
    [F] F
-

Definition

+

Definition

dup i
-

Discussion

+

Discussion

The x combinator …


xor

Basis Function Combinator

Same as a ^ b.

Gentzen diagram.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.


zip

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.

-

Definition

+

Definition

if not basis.

-

Derivation

+

Derivation

if not basis.

-

Source

+

Source

if basis

-

Discussion

+

Discussion

Lorem ipsum.

- +

Lorem ipsum.

diff --git a/docs/reference/mkref/Functor-Reference.md b/docs/reference/mkref/Functor-Reference.md index e5b7b59..394c5d0 100644 --- a/docs/reference/mkref/Functor-Reference.md +++ b/docs/reference/mkref/Functor-Reference.md @@ -2479,31 +2479,31 @@ A fine old word from Forth. ## pam -Basis Function Combinator - -\[i\] map - -Gentzen diagram. - -### Definition +Combinator -if not basis. +Take a list of quoted functions from the stack and replace it with a list +of the [first] results from running those functions (on copies of the +rest of the stack.) -### Derivation +### Example -if not basis. + 5 7 [[+][-][*][/][%]] pam + ------------------------------- + 5 7 [12 -2 35 0 5] -### Source +### Definition -if basis +> \[[i]\] [map] ### Discussion -Lorem ipsum. +A specialization of [map] that runs a list of functions in parallel (if +the underlying [map] function is so implemented, of course.) ### Crosslinks -Lorem ipsum. +[map] + -------------- @@ -2516,392 +2516,292 @@ See [getitem](#getitem). ## pm -Basis Function Combinator - -Plus or minus : +Function - a b pm - ------------- - a+b a-b +Plus or minus. Replace two numbers with their sum and difference. -Gentzen diagram. + a b pm + ----------------- + (a+b) (a-b) ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source +> \[+\] \[-\] [clop] -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. ------------------------------------------------------------------------ ## pop -Basis Function Combinator - - (a1 --) - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +Basis Function -### Discussion +Pop the top item from the stack and discard it. -Lorem ipsum. + a pop + ----------- ### Crosslinks -Lorem ipsum. +[popd] +[popdd] +[popop] +[popopd] +[popopdd] +[popopop] + ------------------------------------------------------------------------ ## popd -Basis Function Combinator +Function - (a2 a1 -- a1) +[pop] the second item down on the stack. -Gentzen diagram. + a b popd + -------------- + b ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [swap] [pop] ### Crosslinks -Lorem ipsum. +[pop] +[popdd] +[popop] +[popopd] +[popopdd] +[popopop] + ------------------------------------------------------------------------ ## popdd -Basis Function Combinator +Function - (a3 a2 a1 -- a2 a1) +[pop] the third item on the stack. -Gentzen diagram. + a b c popdd + ----------------- + b c ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rolldown] [pop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popop] +[popopd] +[popopdd] +[popopop] + ------------------------------------------------------------------------ ## popop -Basis Function Combinator +Function - (a2 a1 --) +[pop] two items from the stack. -Gentzen diagram. + a b popop + --------------- ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [pop] [pop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popopd] +[popopdd] +[popopop] + ------------------------------------------------------------------------ ## popopd -Basis Function Combinator +Function - (a3 a2 a1 -- a1) +[pop] the second and third items from the stack. -Gentzen diagram. + a b c popopd + ------------------ + c ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rollup] [popop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popop] +[popopdd] +[popopop] + ------------------------------------------------------------------------ ## popopdd -Basis Function Combinator - - (a4 a3 a2 a1 -- a2 a1) +Function -Gentzen diagram. + a b c d popopdd + --------------------- + c d ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> \[[popop]\] [dipd] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popop] +[popopd] +[popopop] + ------------------------------------------------------------------------ ## popopop -Basis Function Combinator +Function -pop popop +[pop] three items from the stack. -Gentzen diagram. + a b c popopop + ------------------- ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [pop] [popop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popop] +[popopd] +[popopdd] + ------------------------------------------------------------------------ ## pow -Basis Function Combinator - -Same as a \*\* b. - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. +Basis Function -### Source +Take two numbers `a` and `b` from the stack and raise `a` to the `n`th +power. (`b` is on the top of the stack.) -if basis - -### Discussion + a n pow + ------------- + (aⁿ) -Lorem ipsum. +### Example -### Crosslinks + 2 [2 3 4 5 6 7 8 9] [pow] map + ----------------------------------- + 2 [4 8 16 32 64 128 256 512] -Lorem ipsum. ------------------------------------------------------------------------ ## pred -Basis Function Combinator - -Decrement TOS. +Function -Gentzen diagram. +Predecessor. Decrement TOS. ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> 1 - ### Crosslinks -Lorem ipsum. +[succ] + ------------------------------------------------------------------------ ## primrec -Basis Function Combinator +Combinator -From the \"Overview of the language JOY\": +From the ["Overview of the language JOY"](https://www.kevinalbrecht.com/code/joy-mirror/j00ovr.html) -\> The primrec combinator expects two quoted programs in addition to a -data parameter. For an integer data parameter it works like this: If the -data parameter is zero, then the first quotation has to produce the -value to be returned. If the data parameter is positive then the second -has to combine the data parameter with the result of applying the -function to its predecessor.: +> The primrec combinator expects two quoted programs in addition to a +> data parameter. For an integer data parameter it works like this: If +> the data parameter is zero, then the first quotation has to produce the +> value to be returned. If the data parameter is positive then the second +> has to combine the data parameter with the result of applying the +> function to its predecessor. - 5 [1] [*] primrec +> 5 \[1\] \[\*\] primrec -\> Then primrec tests whether the top element on the stack (initially -the 5) is equal to zero. If it is, it pops it off and executes one of -the quotations, the \[1\] which leaves 1 on the stack as the result. -Otherwise it pushes a decremented copy of the top element and recurses. -On the way back from the recursion it uses the other quotation, \[\*\], -to multiply what is now a factorial on top of the stack by the second -element on the stack.: +> Then primrec tests whether the top element on the stack (initially the +> 5) is equal to zero. If it is, it pops it off and executes one of the +> quotations, the \[1\] which leaves 1 on the stack as the result. +> Otherwise it pushes a decremented copy of the top element and recurses. +> On the way back from the recursion it uses the other quotation, \[\*\], +> to multiply what is now a factorial on top of the stack by the second +> element on the stack. - n [Base] [Recur] primrec 0 [Base] [Recur] primrec ------------------------------ Base - n [Base] [Recur] primrec + n [Base] [Recur] primrec ------------------------------------------ n > 0 n (n-1) [Base] [Recur] primrec Recur -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Simple and useful specialization of the [genrec] combinator from the +[original Joy system](https://www.kevinalbrecht.com/code/joy-mirror/index.html). ### Crosslinks -Lorem ipsum. +[genrec] +[tailrec] + ------------------------------------------------------------------------ ## product -Basis Function Combinator - -1 swap \[\*\] step +Function -Gentzen diagram. +Just as [sum] sums a list of numbers, this function multiplies them +together. ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> 1 [swap] \[[mul]\] [step] -### Discussion +Or, -Lorem ipsum. +> \[1\] \[[mul]\] [primrec] -### Crosslinks -Lorem ipsum. ------------------------------------------------------------------------ diff --git a/docs/reference/pam.md b/docs/reference/pam.md index a763007..06178c3 100644 --- a/docs/reference/pam.md +++ b/docs/reference/pam.md @@ -2,28 +2,28 @@ ## pam -Basis Function Combinator +Combinator -\[i\] map +Take a list of quoted functions from the stack and replace it with a list +of the [first] results from running those functions (on copies of the +rest of the stack.) -Gentzen diagram. +### Example -### Definition - -if not basis. - -### Derivation + 5 7 [[+][-][*][/][%]] pam + ------------------------------- + 5 7 [12 -2 35 0 5] -if not basis. - -### Source +### Definition -if basis +> \[[i]\] [map] ### Discussion -Lorem ipsum. +A specialization of [map] that runs a list of functions in parallel (if +the underlying [map] function is so implemented, of course.) ### Crosslinks -Lorem ipsum. +[map] + diff --git a/docs/reference/pm.md b/docs/reference/pm.md index a00dc94..9322c60 100644 --- a/docs/reference/pm.md +++ b/docs/reference/pm.md @@ -2,32 +2,15 @@ ## pm -Basis Function Combinator +Function -Plus or minus : +Plus or minus. Replace two numbers with their sum and difference. - a b pm - ------------- - a+b a-b - -Gentzen diagram. + a b pm + ----------------- + (a+b) (a-b) ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks +> \[+\] \[-\] [clop] -Lorem ipsum. diff --git a/docs/reference/pop.md b/docs/reference/pop.md index 48da3ea..dc93fdb 100644 --- a/docs/reference/pop.md +++ b/docs/reference/pop.md @@ -2,28 +2,19 @@ ## pop -Basis Function Combinator +Basis Function - (a1 --) +Pop the top item from the stack and discard it. -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. + a pop + ----------- ### Crosslinks -Lorem ipsum. +[popd] +[popdd] +[popop] +[popopd] +[popopdd] +[popopop] + diff --git a/docs/reference/popd.md b/docs/reference/popd.md index 1016b57..679e13d 100644 --- a/docs/reference/popd.md +++ b/docs/reference/popd.md @@ -2,28 +2,24 @@ ## popd -Basis Function Combinator +Function - (a2 a1 -- a1) +[pop] the second item down on the stack. -Gentzen diagram. + a b popd + -------------- + b ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [swap] [pop] ### Crosslinks -Lorem ipsum. +[pop] +[popdd] +[popop] +[popopd] +[popopdd] +[popopop] + diff --git a/docs/reference/popdd.md b/docs/reference/popdd.md index 6e9504b..af75b36 100644 --- a/docs/reference/popdd.md +++ b/docs/reference/popdd.md @@ -2,28 +2,24 @@ ## popdd -Basis Function Combinator +Function - (a3 a2 a1 -- a2 a1) +[pop] the third item on the stack. -Gentzen diagram. + a b c popdd + ----------------- + b c ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rolldown] [pop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popop] +[popopd] +[popopdd] +[popopop] + diff --git a/docs/reference/popop.md b/docs/reference/popop.md index 8b6c10c..bf9b72a 100644 --- a/docs/reference/popop.md +++ b/docs/reference/popop.md @@ -2,28 +2,23 @@ ## popop -Basis Function Combinator +Function - (a2 a1 --) +[pop] two items from the stack. -Gentzen diagram. + a b popop + --------------- ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [pop] [pop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popopd] +[popopdd] +[popopop] + diff --git a/docs/reference/popopd.md b/docs/reference/popopd.md index 8b6e4af..c5de7c0 100644 --- a/docs/reference/popopd.md +++ b/docs/reference/popopd.md @@ -2,28 +2,24 @@ ## popopd -Basis Function Combinator +Function - (a3 a2 a1 -- a1) +[pop] the second and third items from the stack. -Gentzen diagram. + a b c popopd + ------------------ + c ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rollup] [popop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popop] +[popopdd] +[popopop] + diff --git a/docs/reference/popopdd.md b/docs/reference/popopdd.md index 3122141..9fb56df 100644 --- a/docs/reference/popopdd.md +++ b/docs/reference/popopdd.md @@ -2,28 +2,22 @@ ## popopdd -Basis Function Combinator +Function - (a4 a3 a2 a1 -- a2 a1) - -Gentzen diagram. + a b c d popopdd + --------------------- + c d ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> \[[popop]\] [dipd] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popop] +[popopd] +[popopop] + diff --git a/docs/reference/popopop.md b/docs/reference/popopop.md index f19d92c..41cad2b 100644 --- a/docs/reference/popopop.md +++ b/docs/reference/popopop.md @@ -2,28 +2,23 @@ ## popopop -Basis Function Combinator +Function -pop popop +[pop] three items from the stack. -Gentzen diagram. + a b c popopop + ------------------- ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [pop] [popop] ### Crosslinks -Lorem ipsum. +[pop] +[popd] +[popdd] +[popop] +[popopd] +[popopdd] + diff --git a/docs/reference/pow.md b/docs/reference/pow.md index a12647f..9d439a3 100644 --- a/docs/reference/pow.md +++ b/docs/reference/pow.md @@ -2,28 +2,18 @@ ## pow -Basis Function Combinator +Basis Function -Same as a \*\* b. +Take two numbers `a` and `b` from the stack and raise `a` to the `n`th +power. (`b` is on the top of the stack.) -Gentzen diagram. + a n pow + ------------- + (aⁿ) -### Definition +### Example -if not basis. + 2 [2 3 4 5 6 7 8 9] [pow] map + ----------------------------------- + 2 [4 8 16 32 64 128 256 512] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/pred.md b/docs/reference/pred.md index 7e2760e..1bfea43 100644 --- a/docs/reference/pred.md +++ b/docs/reference/pred.md @@ -2,28 +2,15 @@ ## pred -Basis Function Combinator +Function -Decrement TOS. - -Gentzen diagram. +Predecessor. Decrement TOS. ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> 1 - ### Crosslinks -Lorem ipsum. +[succ] + diff --git a/docs/reference/primrec.md b/docs/reference/primrec.md index bbafc14..e72d148 100644 --- a/docs/reference/primrec.md +++ b/docs/reference/primrec.md @@ -2,55 +2,43 @@ ## primrec -Basis Function Combinator +Combinator -From the \"Overview of the language JOY\": +From the ["Overview of the language JOY"](https://www.kevinalbrecht.com/code/joy-mirror/j00ovr.html) -\> The primrec combinator expects two quoted programs in addition to a -data parameter. For an integer data parameter it works like this: If the -data parameter is zero, then the first quotation has to produce the -value to be returned. If the data parameter is positive then the second -has to combine the data parameter with the result of applying the -function to its predecessor.: +> The primrec combinator expects two quoted programs in addition to a +> data parameter. For an integer data parameter it works like this: If +> the data parameter is zero, then the first quotation has to produce the +> value to be returned. If the data parameter is positive then the second +> has to combine the data parameter with the result of applying the +> function to its predecessor. - 5 [1] [*] primrec +> 5 \[1\] \[\*\] primrec -\> Then primrec tests whether the top element on the stack (initially -the 5) is equal to zero. If it is, it pops it off and executes one of -the quotations, the \[1\] which leaves 1 on the stack as the result. -Otherwise it pushes a decremented copy of the top element and recurses. -On the way back from the recursion it uses the other quotation, \[\*\], -to multiply what is now a factorial on top of the stack by the second -element on the stack.: +> Then primrec tests whether the top element on the stack (initially the +> 5) is equal to zero. If it is, it pops it off and executes one of the +> quotations, the \[1\] which leaves 1 on the stack as the result. +> Otherwise it pushes a decremented copy of the top element and recurses. +> On the way back from the recursion it uses the other quotation, \[\*\], +> to multiply what is now a factorial on top of the stack by the second +> element on the stack. - n [Base] [Recur] primrec 0 [Base] [Recur] primrec ------------------------------ Base - n [Base] [Recur] primrec + n [Base] [Recur] primrec ------------------------------------------ n > 0 n (n-1) [Base] [Recur] primrec Recur -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Simple and useful specialization of the [genrec] combinator from the +[original Joy system](https://www.kevinalbrecht.com/code/joy-mirror/index.html). ### Crosslinks -Lorem ipsum. +[genrec] +[tailrec] + diff --git a/docs/reference/product.md b/docs/reference/product.md index 8585f6e..a9a1387 100644 --- a/docs/reference/product.md +++ b/docs/reference/product.md @@ -2,28 +2,17 @@ ## product -Basis Function Combinator +Function -1 swap \[\*\] step - -Gentzen diagram. +Just as [sum] sums a list of numbers, this function multiplies them +together. ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> 1 [swap] \[[mul]\] [step] -### Discussion +Or, -Lorem ipsum. +> \[1\] \[[mul]\] [primrec] -### Crosslinks -Lorem ipsum.