From dd7374ef81fcd1a6687854ccf4188be5c8170303 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Mon, 28 Mar 2022 18:39:42 -0700 Subject: [PATCH] Q, R's and some S's. --- docs/reference/mkref/FuncRef.html | 820 ++++++++++------------ docs/reference/mkref/Functor-Reference.md | 584 +++++---------- docs/reference/quoted.md | 23 +- docs/reference/range.md | 30 +- docs/reference/range_to_zero.md | 27 +- docs/reference/reco.md | 26 +- docs/reference/remove.md | 27 +- docs/reference/rest.md | 28 +- docs/reference/reverse.md | 27 +- docs/reference/rolldown.md | 25 +- docs/reference/rollup.md | 25 +- docs/reference/round.md | 26 +- docs/reference/rrest.md | 26 +- docs/reference/run.md | 27 +- docs/reference/second.md | 27 +- docs/reference/select.md | 34 +- docs/reference/sharing.md | 22 +- docs/reference/shift.md | 27 +- docs/reference/shunt.md | 26 +- docs/reference/size.md | 27 +- docs/reference/sort.md | 25 +- docs/reference/spiral_next.md | 25 +- docs/reference/split_at.md | 28 +- docs/reference/split_list.md | 26 +- docs/reference/sqr.md | 25 +- docs/reference/sqrt.md | 19 +- docs/reference/stack.md | 26 +- docs/reference/stackd.md | 27 +- docs/reference/step.md | 42 +- docs/reference/step_zero.md | 2 +- 30 files changed, 775 insertions(+), 1354 deletions(-) diff --git a/docs/reference/mkref/FuncRef.html b/docs/reference/mkref/FuncRef.html index 9d4e444..8a1cada 100644 --- a/docs/reference/mkref/FuncRef.html +++ b/docs/reference/mkref/FuncRef.html @@ -1792,64 +1792,68 @@ a F a

quoted

-

Basis Function Combinator

-

[unit] dip

-

Gentzen diagram.

+

Function

+

“Quote D” Wrap the second item on the stack in a list.

+
   a b quoted
+----------------
+     [a] b

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

+
+

[unit] dip

+

Discussion

-

Lorem ipsum.

+

This comes from the original Joy stuff.

-

Lorem ipsum.

+

unit


range

-

Basis Function Combinator

-

[0 <=] [1 - dup] anamorphism

-

Gentzen diagram.

+

Function

+

Expect a number n on the stack and replace it with a list: [(n-1)...0].

+

Example

+
     5 range
+-----------------
+   [4 3 2 1 0]
+
+   -5 range
+--------------
+      []

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

+
+

[0 <=] [1 - dup] anamorphism

+

Discussion

-

Lorem ipsum.

+

If n is less than 1 the resulting list is empty.

-

Lorem ipsum.

+

range_to_zero


range_to_zero

-

Basis Function Combinator

-

unit [down_to_zero] infra

-

Gentzen diagram.

+

Function

+

Take a number n from the stack and replace it with a list [0...n].

+

Example

+
   5 range_to_zero
+---------------------
+    [0 1 2 3 4 5]

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

+
+

unit [down_to_zero] infra

+

Discussion

-

Lorem ipsum.

+

Note that the order is reversed compared to range.

-

Lorem ipsum.

+

down_to_zero range


reco

-

Basis Function Combinator

-

rest cons

-

Gentzen diagram.

+

Function

+

Replace the first item in a list with the item under it.

+
   a [b ...] reco
+--------------------
+     [a ...]

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

+
+

rest cons

+
-

Lorem ipsum.

+

codireco make_generator


rem

See mod.

@@ -1858,83 +1862,57 @@ a F a

See mod.


remove

-

Basis Function Combinator

-

Expects an item on the stack and a quote under it and removes that item from the the quote. The item is only removed once. If the list is empty or the item isn't in the list then the list is unchanged. :

-
[1 2 3 1] 1 remove
+

Function

+

Expects an item on the stack and a quote under it and removes that item from the the quote. The item is only removed once. If the list is empty or the item isn’t in the list then the list is unchanged.

+
   [1 2 3 1] 1 remove
 ------------------------
-  [2 3 1]
-

Gentzen diagram.

+ [2 3 1]

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

See the “Remove Function” notebook.


rest

-

Basis Function Combinator

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

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Basis Function

+
   [a ...] rest
+------------------
+      [...]
+ +

first uncons


reverse

-

Basis Function Combinator

-

Reverse the list on the top of the stack. :

-
reverse == [] swap shunt
-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Reverse the list on the top of the stack.

+

Example

+
   [1 2 3] reverse
+---------------------
+       [3 2 1]
+

Definition

+
+

<{} shunt

+

rolldown

-

Basis Function Combinator

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

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+
   a b c rolldown
+--------------------
+       b c a
+

Definition

+
+

swapd swap

+
+ +

rollup


rollup

-

Basis Function Combinator

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

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+
   a b c rollup
+------------------
+      c a b
+

Definition

+
+

swap swapd

+
+ +

rolldown


roll>

See rollup.

@@ -1943,35 +1921,22 @@ a F a

See rolldown.


round

-

Basis Function Combinator

+

Function

Round a number to a given precision in decimal digits.

-

The return value is an integer if ndigits is omitted or None. Otherwise the return value has the same type as the number. ndigits may be negative.

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Discussion

+

Another one that won’t make sense until the “numeric tower” is nailed down.


rrest

-

Basis Function Combinator

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

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+
   [a b ...] rrest
+---------------------
+        [...]
+

Definition

+
+

rest rest

+
+ +

rest


rshift

Basis Function

@@ -1979,246 +1944,201 @@ a F a
   a n rshift
 ----------------
      (a∕2ⁿ)
- +

lshift


run

-

Basis Function Combinator

-

<{} infra

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Run a quoted program in a list.

+

Example

+
   [1 2 +] run
+-----------------
+       [3]
+

Definition

+
+

<{} infra

+

second

-

Basis Function Combinator

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

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+
   [a b ...] second
+----------------------
+          b
+

Definition

+
+

rest first

+
+ +

first third fourth


select

-

Basis Function Combinator

+

Basis Function

Use a Boolean value to select one of two items from a sequence. :

-
[A B] false select
+
   [a b] false select
 ------------------------
- A
+           a
 
-
-[A B] true select
+   [a b] true select
 -----------------------
-   B
-

The sequence can contain more than two items but not fewer. Currently Python semantics are used to evaluate the "truthiness" of the Boolean value (so empty string, zero, etc. are counted as false, etc.)

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+ b
+

Discussion

+

The sequence can contain more than two items but not fewer.

+ +

choice


sharing

-

Basis Function Combinator

+

Function

Print redistribution information.

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Discussion

+

Mathematically this is a form of id, but it has the side-effect of printing out the GPL notice.

+ +

warranty


shift

-

Basis Function Combinator

-

uncons [swons] dip

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Move the top item from one list to another.

+

Example

+
   [x y z] [a b c] shift
+---------------------------
+      [a x y z] [b c]
+

Definition

+
+

uncons [swons] dip

+
+ +

shunt


shunt

-

Basis Function Combinator

-

Like concat but reverses the top list into the second. :

-
shunt == [swons] step == reverse swap concat
-
-   [a b c] [d e f] shunt
+

Function

+

Like concat but reverse the top list into the second.

+

Example

+
   [a b c] [d e f] shunt
 ---------------------------
        [f e d a b c] 
-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Definition

+
+

[swons] step

+
+

Discussion

+

This is more efficient than concat so prefer it if you don’t need to preserve order.

+ +

concat reverse shift


size

-

Basis Function Combinator

-

[pop ++] step_zero

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Replace a list with its size.

+

Example

+
   [23 [cats] 4] size
+------------------------
+           3
+

Definition

+
+

[pop ++] step_zero

+

sort

-

Basis Function Combinator

+

Function

Given a list return it sorted.

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Example

+
   [4 2 5 7 1] sort
+----------------------
+      [1 2 4 5 7]

spiral_next

-

Basis Function Combinator

-

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

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Example code.

+

Discussion

+

See the “Square Spiral Example Joy Code” notebook.


split_at

-

Basis Function Combinator

-

[drop] [take] clop

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Split a list (second on the stack) at the position given by the number on the top of the stack.

+

Example

+
   [1 2 3 4 5 6 7] 4 split_at
+--------------------------------
+       [5 6 7] [4 3 2 1]
+

Definition

+
+

[drop] [take] clop

+
+

Discussion

+

Take a list and a number n from the stack, take n items from the top of the list and shunt them onto a new list that replaces the number n on the top of the stack.

+ +

split_list


split_list

-

Basis Function Combinator

-

[take reverse] [drop] clop

-

Gentzen diagram.

-

Definition

-

if not basis.

-

Derivation

-

if not basis.

-

Source

-

if basis

-

Discussion

-

Lorem ipsum.

- -

Lorem ipsum.

+

Function

+

Split a list (second on the stack) at the position given by the number on the top of the stack such that concat would reconstruct the original list.

+
   [1 2 3 4 5 6 7] 4 split_list
+----------------------------------
+        [1 2 3 4] [5 6 7]
+

Definition

+
+

[take reverse] [drop] clop

+
+

Discussion

+

Compare with split_at. This function does extra work to ensure that concat would reconstruct the original list.

+ +

split_at


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

@@ -2239,90 +2159,90 @@ a F a
... a . Q [b c] [Q] step

The step combinator executes the quotation on each member of the list on top of the stack.

Gentzen diagram.

-

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

@@ -2330,105 +2250,105 @@ a F a

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

@@ -2438,15 +2358,15 @@ a F a ---------------------- [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

@@ -2455,26 +2375,26 @@ a F a
   ... 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

@@ -2494,15 +2414,15 @@ a F a ------------------------------------- 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

@@ -2512,15 +2432,15 @@ a F a

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

@@ -2529,11 +2449,11 @@ a F a
   ... 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

@@ -2542,131 +2462,131 @@ a F a
   [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

@@ -2674,39 +2594,39 @@ a F a
   [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 394c5d0..b2e6f95 100644 --- a/docs/reference/mkref/Functor-Reference.md +++ b/docs/reference/mkref/Functor-Reference.md @@ -2807,121 +2807,109 @@ Or, ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[unit]\] [dip] ### Discussion -Lorem ipsum. +This comes from the original Joy stuff. ### Crosslinks -Lorem ipsum. +[unit] + ------------------------------------------------------------------------ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[0 \<=\] \[1 - [dup]\] [anamorphism] ### Discussion -Lorem ipsum. +If `n` is less than 1 the resulting list is empty. ### Crosslinks -Lorem ipsum. +[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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> [unit] \[[down_to_zero]\] [infra] ### Discussion -Lorem ipsum. +Note that the order is reversed compared to [range]. ### Crosslinks -Lorem ipsum. +[down_to_zero] +[range] + ------------------------------------------------------------------------ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rest] [cons] ### Crosslinks -Lorem ipsum. +[codireco] +[make_generator] + -------------- @@ -2941,159 +2929,93 @@ See [mod](#mod). ## remove -Basis Function Combinator +Function Expects an item on the stack and a quote under it and removes that item from the the quote. The item is only removed once. If the list is empty -or the item isn\'t in the list then the list is unchanged. : +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] - -Gentzen diagram. + [2 3 1] ### 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 -Basis Function Combinator +Basis Function - ([a1 ...0] -- [...0]) - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. + [a ...] rest + ------------------ + [...] ### Crosslinks -Lorem ipsum. +[first] +[uncons] + ------------------------------------------------------------------------ ## 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 -if not basis. +> [\<\{\}] [shunt] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. ------------------------------------------------------------------------ ## rolldown -Basis Function Combinator +Function - (a1 a2 a3 -- a2 a3 a1) - -Gentzen diagram. + a b c rolldown + -------------------- + b c a ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [swapd] [swap] ### Crosslinks -Lorem ipsum. +[rollup] + ------------------------------------------------------------------------ ## rollup -Basis Function Combinator +Function - (a1 a2 a3 -- a3 a1 a2) - -Gentzen diagram. + a b c rollup + ------------------ + c a b ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [swap] [swapd] ### Crosslinks -Lorem ipsum. +[rolldown] + -------------- @@ -3113,65 +3035,33 @@ See [rolldown](#rolldown). ## round -Basis Function Combinator +Function Round a number to a given precision in decimal digits. -The return value is an integer if ndigits is omitted or None. Otherwise -the return value has the same type as the number. ndigits may be -negative. - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Another one that won't make sense until the "numeric tower" is nailed +down. -### Crosslinks - -Lorem ipsum. ------------------------------------------------------------------------ ## rrest -Basis Function Combinator - - ([a1 a2 ...1] -- [...1]) - -Gentzen diagram. +Function + [a b ...] rrest + --------------------- + [...] ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rest] [rest] ### Crosslinks -Lorem ipsum. +[rest] + ------------------------------------------------------------------------ @@ -3193,352 +3083,242 @@ Basis Function ## run -Basis Function Combinator +Function -\<{} infra +Run a quoted program in a list. -Gentzen diagram. +### Example + + [1 2 +] run + ----------------- + [3] ### Definition -if not basis. +> [\<\{\}] [infra] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. ------------------------------------------------------------------------ ## second -Basis Function Combinator +Function - ([a1 a2 ...1] -- a2) - -Gentzen diagram. + [a b ...] second + ---------------------- + b ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rest] [first] ### Crosslinks -Lorem ipsum. +[first] +[third] +[fourth] + ------------------------------------------------------------------------ ## select -Basis Function Combinator +Basis Function Use a Boolean value to select one of two items from a sequence. : - [A B] false select + [a b] false select ------------------------ - A + a - - [A B] true select + [a b] true select ----------------------- - B - -The sequence can contain more than two items but not fewer. Currently -Python semantics are used to evaluate the \"truthiness\" of the Boolean -value (so empty string, zero, etc. are counted as false, etc.) - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis + b ### Discussion -Lorem ipsum. +The sequence can contain more than two items but not fewer. ### Crosslinks -Lorem ipsum. +[choice] + ------------------------------------------------------------------------ ## sharing -Basis Function Combinator +Function Print redistribution information. -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Mathematically this is a form of [id], but it has the side-effect of +printing out the GPL notice. ### Crosslinks -Lorem ipsum. +[warranty] + ------------------------------------------------------------------------ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [uncons] \[[swons]\] [dip] ### Crosslinks -Lorem ipsum. +[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 --------------------------- [f e d a b c] -Gentzen diagram. - ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[swons]\] [step] ### Discussion -Lorem ipsum. +This is more efficient than [concat] so prefer it if you don't need to +preserve order. ### Crosslinks -Lorem ipsum. +[concat] +[reverse] +[shift] + ------------------------------------------------------------------------ ## size -Basis Function Combinator +Function -\[pop ++\] step_zero +Replace a list with its size. -Gentzen diagram. +### Example + + [23 [cats] 4] size + ------------------------ + 3 ### Definition -if not basis. +> \[[pop] [++]\] [step_zero] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. ------------------------------------------------------------------------ ## sort -Basis Function Combinator +Function 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 -Basis Function Combinator +Function -\[\[\[abs\] ii \<=\] \[\[\<\>\] \[pop !-\] \|\|\] &&\] \[\[!-\] -\[\[++\]\] \[\[\--\]\] ifte dip\] \[\[pop !-\] \[\--\] \[++\] ifte\] -ifte - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +Example code. ### Discussion -Lorem ipsum. +See the ["Square Spiral Example Joy Code" notebook](https://joypy.osdn.io/notebooks/Square_Spiral.html). -### Crosslinks - -Lorem ipsum. ------------------------------------------------------------------------ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[drop]\] \[[take]\] [clop] ### 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 -Lorem ipsum. +[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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[take] [reverse]\] \[[drop]\] [clop] ### Discussion -Lorem ipsum. +Compare with [split_at]. This function does extra work to ensure that +[concat] would reconstruct the original list. ### Crosslinks -Lorem ipsum. +[split_at] + ------------------------------------------------------------------------ diff --git a/docs/reference/quoted.md b/docs/reference/quoted.md index 0dcf523..04d4add 100644 --- a/docs/reference/quoted.md +++ b/docs/reference/quoted.md @@ -2,28 +2,23 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[unit]\] [dip] ### Discussion -Lorem ipsum. +This comes from the original Joy stuff. ### Crosslinks -Lorem ipsum. +[unit] + diff --git a/docs/reference/range.md b/docs/reference/range.md index da6400d..ea6f0a5 100644 --- a/docs/reference/range.md +++ b/docs/reference/range.md @@ -2,28 +2,30 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[0 \<=\] \[1 - [dup]\] [anamorphism] ### Discussion -Lorem ipsum. +If `n` is less than 1 the resulting list is empty. ### Crosslinks -Lorem ipsum. +[range_to_zero] + diff --git a/docs/reference/range_to_zero.md b/docs/reference/range_to_zero.md index af4e0d9..5c357bd 100644 --- a/docs/reference/range_to_zero.md +++ b/docs/reference/range_to_zero.md @@ -2,28 +2,27 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> [unit] \[[down_to_zero]\] [infra] ### Discussion -Lorem ipsum. +Note that the order is reversed compared to [range]. ### Crosslinks -Lorem ipsum. +[down_to_zero] +[range] + diff --git a/docs/reference/reco.md b/docs/reference/reco.md index b1d949f..a4f006f 100644 --- a/docs/reference/reco.md +++ b/docs/reference/reco.md @@ -2,28 +2,20 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rest] [cons] ### Crosslinks -Lorem ipsum. +[codireco] +[make_generator] + diff --git a/docs/reference/remove.md b/docs/reference/remove.md index 983f9a1..cd3d55f 100644 --- a/docs/reference/remove.md +++ b/docs/reference/remove.md @@ -2,34 +2,17 @@ ## remove -Basis Function Combinator +Function Expects an item on the stack and a quote under it and removes that item from the the quote. The item is only removed once. If the list is empty -or the item isn\'t in the list then the list is unchanged. : +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] - -Gentzen diagram. + [2 3 1] ### 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. diff --git a/docs/reference/rest.md b/docs/reference/rest.md index c7b5205..c3febc8 100644 --- a/docs/reference/rest.md +++ b/docs/reference/rest.md @@ -2,28 +2,14 @@ ## rest -Basis Function Combinator +Basis Function - ([a1 ...0] -- [...0]) - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. + [a ...] rest + ------------------ + [...] ### Crosslinks -Lorem ipsum. +[first] +[uncons] + diff --git a/docs/reference/reverse.md b/docs/reference/reverse.md index 2cff4d9..d5f6cdb 100644 --- a/docs/reference/reverse.md +++ b/docs/reference/reverse.md @@ -2,30 +2,17 @@ ## 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 -if not basis. +> [\<\{\}] [shunt] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/rolldown.md b/docs/reference/rolldown.md index b183ab9..b9c9d6d 100644 --- a/docs/reference/rolldown.md +++ b/docs/reference/rolldown.md @@ -2,28 +2,17 @@ ## rolldown -Basis Function Combinator +Function - (a1 a2 a3 -- a2 a3 a1) - -Gentzen diagram. + a b c rolldown + -------------------- + b c a ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [swapd] [swap] ### Crosslinks -Lorem ipsum. +[rollup] + diff --git a/docs/reference/rollup.md b/docs/reference/rollup.md index 69924a2..ca12721 100644 --- a/docs/reference/rollup.md +++ b/docs/reference/rollup.md @@ -2,28 +2,17 @@ ## rollup -Basis Function Combinator +Function - (a1 a2 a3 -- a3 a1 a2) - -Gentzen diagram. + a b c rollup + ------------------ + c a b ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [swap] [swapd] ### Crosslinks -Lorem ipsum. +[rolldown] + diff --git a/docs/reference/round.md b/docs/reference/round.md index 2ac9869..f215c75 100644 --- a/docs/reference/round.md +++ b/docs/reference/round.md @@ -2,32 +2,12 @@ ## round -Basis Function Combinator +Function Round a number to a given precision in decimal digits. -The return value is an integer if ndigits is omitted or None. Otherwise -the return value has the same type as the number. ndigits may be -negative. - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Another one that won't make sense until the "numeric tower" is nailed +down. -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/rrest.md b/docs/reference/rrest.md index 10d1d25..474eded 100644 --- a/docs/reference/rrest.md +++ b/docs/reference/rrest.md @@ -2,28 +2,16 @@ ## rrest -Basis Function Combinator - - ([a1 a2 ...1] -- [...1]) - -Gentzen diagram. +Function + [a b ...] rrest + --------------------- + [...] ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rest] [rest] ### Crosslinks -Lorem ipsum. +[rest] + diff --git a/docs/reference/run.md b/docs/reference/run.md index a8a72c3..04d1758 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -2,28 +2,17 @@ ## run -Basis Function Combinator +Function -\<{} infra +Run a quoted program in a list. -Gentzen diagram. +### Example + + [1 2 +] run + ----------------- + [3] ### Definition -if not basis. +> [\<\{\}] [infra] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/second.md b/docs/reference/second.md index bf4af31..c1f4fdc 100644 --- a/docs/reference/second.md +++ b/docs/reference/second.md @@ -2,28 +2,19 @@ ## second -Basis Function Combinator +Function - ([a1 a2 ...1] -- a2) - -Gentzen diagram. + [a b ...] second + ---------------------- + b ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [rest] [first] ### Crosslinks -Lorem ipsum. +[first] +[third] +[fourth] + diff --git a/docs/reference/select.md b/docs/reference/select.md index 73d01a0..96bddf7 100644 --- a/docs/reference/select.md +++ b/docs/reference/select.md @@ -2,41 +2,23 @@ ## select -Basis Function Combinator +Basis Function Use a Boolean value to select one of two items from a sequence. : - [A B] false select + [a b] false select ------------------------ - A + a - - [A B] true select + [a b] true select ----------------------- - B - -The sequence can contain more than two items but not fewer. Currently -Python semantics are used to evaluate the \"truthiness\" of the Boolean -value (so empty string, zero, etc. are counted as false, etc.) - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis + b ### Discussion -Lorem ipsum. +The sequence can contain more than two items but not fewer. ### Crosslinks -Lorem ipsum. +[choice] + diff --git a/docs/reference/sharing.md b/docs/reference/sharing.md index 044c519..071ad37 100644 --- a/docs/reference/sharing.md +++ b/docs/reference/sharing.md @@ -2,28 +2,16 @@ ## sharing -Basis Function Combinator +Function Print redistribution information. -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Mathematically this is a form of [id], but it has the side-effect of +printing out the GPL notice. ### Crosslinks -Lorem ipsum. +[warranty] + diff --git a/docs/reference/shift.md b/docs/reference/shift.md index f4d1e7e..e840eae 100644 --- a/docs/reference/shift.md +++ b/docs/reference/shift.md @@ -2,28 +2,21 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. +> [uncons] \[[swons]\] [dip] ### Crosslinks -Lorem ipsum. +[shunt] + diff --git a/docs/reference/shunt.md b/docs/reference/shunt.md index a6ccacf..694b126 100644 --- a/docs/reference/shunt.md +++ b/docs/reference/shunt.md @@ -2,34 +2,28 @@ ## 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 --------------------------- [f e d a b c] -Gentzen diagram. - ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[swons]\] [step] ### Discussion -Lorem ipsum. +This is more efficient than [concat] so prefer it if you don't need to +preserve order. ### Crosslinks -Lorem ipsum. +[concat] +[reverse] +[shift] + diff --git a/docs/reference/size.md b/docs/reference/size.md index 8a08da2..cc690ab 100644 --- a/docs/reference/size.md +++ b/docs/reference/size.md @@ -2,28 +2,17 @@ ## size -Basis Function Combinator +Function -\[pop ++\] step_zero +Replace a list with its size. -Gentzen diagram. +### Example + + [23 [cats] 4] size + ------------------------ + 3 ### Definition -if not basis. +> \[[pop] [++]\] [step_zero] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/sort.md b/docs/reference/sort.md index b1acd9f..64bfc46 100644 --- a/docs/reference/sort.md +++ b/docs/reference/sort.md @@ -2,28 +2,13 @@ ## sort -Basis Function Combinator +Function 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. diff --git a/docs/reference/spiral_next.md b/docs/reference/spiral_next.md index 8a74ffd..2f0b49d 100644 --- a/docs/reference/spiral_next.md +++ b/docs/reference/spiral_next.md @@ -2,30 +2,11 @@ ## spiral_next -Basis Function Combinator +Function -\[\[\[abs\] ii \<=\] \[\[\<\>\] \[pop !-\] \|\|\] &&\] \[\[!-\] -\[\[++\]\] \[\[\--\]\] ifte dip\] \[\[pop !-\] \[\--\] \[++\] ifte\] -ifte - -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +Example code. ### Discussion -Lorem ipsum. +See the ["Square Spiral Example Joy Code" notebook](https://joypy.osdn.io/notebooks/Square_Spiral.html). -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/split_at.md b/docs/reference/split_at.md index 541b7b1..1c2d8f5 100644 --- a/docs/reference/split_at.md +++ b/docs/reference/split_at.md @@ -2,28 +2,28 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[drop]\] \[[take]\] [clop] ### 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 -Lorem ipsum. +[split_list] + diff --git a/docs/reference/split_list.md b/docs/reference/split_list.md index b7a4258..6cfc386 100644 --- a/docs/reference/split_list.md +++ b/docs/reference/split_list.md @@ -2,28 +2,26 @@ ## 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 -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[[take] [reverse]\] \[[drop]\] [clop] ### Discussion -Lorem ipsum. +Compare with [split_at]. This function does extra work to ensure that +[concat] would reconstruct the original list. ### Crosslinks -Lorem ipsum. +[split_at] + diff --git a/docs/reference/sqr.md b/docs/reference/sqr.md index dd2366d..4e9262f 100644 --- a/docs/reference/sqr.md +++ b/docs/reference/sqr.md @@ -2,28 +2,15 @@ ## sqr -Basis Function Combinator +Function -dup \* +Square the number on the top of the stack. -Gentzen diagram. + n sqr + ------------ + n² ### Definition -if not basis. +> [dup] [mul] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/sqrt.md b/docs/reference/sqrt.md index 97918b0..57997fe 100644 --- a/docs/reference/sqrt.md +++ b/docs/reference/sqrt.md @@ -7,24 +7,7 @@ Basis Function Combinator Return the square root of the number a. Negative numbers return complex roots. -Gentzen diagram. - -### Definition - -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis - ### Discussion -Lorem ipsum. +Another "numeric tower" hatch... -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/stack.md b/docs/reference/stack.md index 120946c..f4e0718 100644 --- a/docs/reference/stack.md +++ b/docs/reference/stack.md @@ -2,28 +2,26 @@ ## stack -Basis Function Combinator +Function - (... -- ... [...]) +Put the stack onto the stack. -Gentzen diagram. + ... c b a stack + --------------------------- + ... c b a [a b c ...] ### Definition -if not basis. - -### Derivation - -if not basis. - -### Source - -if basis +> \[\] [swaack] [dup] [swaack] [first] ### Discussion -Lorem ipsum. +This function forms a pair with [unstack], and together they form the +complement to the "destructive" pair [enstacken] and [disenstacken]. ### Crosslinks -Lorem ipsum. +[unstack] +[enstacken] +[disenstacken] + diff --git a/docs/reference/stackd.md b/docs/reference/stackd.md index 4ef58d4..347f74e 100644 --- a/docs/reference/stackd.md +++ b/docs/reference/stackd.md @@ -2,28 +2,17 @@ ## 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 -if not basis. +> \[[stack]\] [dip] -### Derivation - -if not basis. - -### Source - -if basis - -### Discussion - -Lorem ipsum. - -### Crosslinks - -Lorem ipsum. diff --git a/docs/reference/step.md b/docs/reference/step.md index 4b9eb0e..46ad0c5 100644 --- a/docs/reference/step.md +++ b/docs/reference/step.md @@ -2,45 +2,29 @@ ## 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 + ... [a] [Q] step + ---------------------- + ... a Q - ... [a b c] [Q] . step + ... [a 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 + ... a . Q [b c] [Q] step ### Discussion -Lorem ipsum. +See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html). ### Crosslinks -Lorem ipsum. +[step_zero] + diff --git a/docs/reference/step_zero.md b/docs/reference/step_zero.md index bd51a37..f812907 100644 --- a/docs/reference/step_zero.md +++ b/docs/reference/step_zero.md @@ -2,7 +2,7 @@ ## step_zero -Basis Function Combinator +Combinator 0 roll> step