From 04d3e96a992a6bdfa66689377451e9f2f96ec757 Mon Sep 17 00:00:00 2001 From: sforman Date: Sun, 8 Oct 2023 20:17:02 -0700 Subject: [PATCH] Great progress! --- docs/html/FuncRef.html | 136 +++++++------- docs/reference/Function-Reference.md | 256 +++++++++++---------------- docs/reference/to_html.py | 2 +- implementations/defs.txt | 8 +- 4 files changed, 182 insertions(+), 220 deletions(-) diff --git a/docs/html/FuncRef.html b/docs/html/FuncRef.html index f417ac8..68cca1b 100644 --- a/docs/html/FuncRef.html +++ b/docs/html/FuncRef.html @@ -1,4 +1,4 @@ -Thun Function Reference

Thun Function Reference

Home

Version -10.0.0

Each function, combinator, or definition should be documented here.


!-

Not negative.

+Thun Function Reference

Thun Function Reference

Home

Version -10.0.0

Each function, combinator, or definition should be documented here.


!-

Not negative.

    n !-
 ----------- n < 0
    false
@@ -8,14 +8,14 @@
 ---------- n >= 0
    true
 

Definition

0 >=

Discussion

Return a Boolean value indicating if a number is greater than or equal to -zero.


!=

built-in

See ne.


%

built-in

See mod.


*

built-in

See mul.


+

built-in

See add.


++

See succ.

Definition

1 +

-

built-in

See sub.


--

See pred.

Definition

1 -

/

built-in


//


/floor


<

built-in

See lt.


<<

built-in

See lshift.

Definition


<<{}

   ... b a <{}
+zero.


!=

built-in

See neq.


%

built-in

See mod.


*

built-in

See mul.


+

built-in

See add.


++

See succ.

Definition

1 +

-

built-in

See sub.


--

See pred.

Definition

1 -

/

built-in

See div.


/\

Binary Boolean and.

Definition


<

built-in

See lt.


<<

built-in

See lshift.

Definition


<<{}

   ... b a <{}
 -----------------
    ... [] b a
-

Definition

Discussion

Tuck an empty list just under the first two items on the stack.


<=

built-in

See le.


<>

built-in

See ne.


<{}

   ... a <{}
+

Definition

Discussion

Tuck an empty list just under the first two items on the stack.


<=

built-in

See le.


<>

built-in

See neq.


<{}

   ... a <{}
 ----------------
    ... [] a
 

Definition

[] swap

Discussion

Tuck an empty list just under the first item on the stack.


=

built-in

See eq.


>

built-in

See gt.


>=

built-in

See ge.


>>

built-in

See rshift.

Definition


?

Is the item on the top of the stack "truthy"?

Definition

Discussion

You often want to test the truth value of an item on the stack without -consuming the item.


^

See xor.


abs

Take an integer from the stack and replace it with its absolute value.

Definition

dup 0 < [] [neg] branch

add

built-in

Take two integers from the stack and replace them with their sum.


anamorphism

combinator

Build a list of values from a generator program G and a stopping +consuming the item.


\/

Binary Boolean or.

Definition


abs

Take an integer from the stack and replace it with its absolute value.

Definition

dup 0 < [] [neg] branch

add

built-in

Take two integers from the stack and replace them with their sum.


anamorphism

combinator

Build a list of values from a generator program G and a stopping predicate P.

           [P] [G] anamorphism
 -----------------------------------------
@@ -102,8 +102,8 @@ item of the result on the stack.

----------------------- ... a

Definition

Discussion

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


bool

Convert the item on the top of the stack to a Boolean value.

Discussion

For integers 0 is false and any other number is true; for lists the -empty list is false and all other lists are true.


branch

combinator built-in

Use a Boolean value to select and run one of two quoted programs.

+consuming exactly two items from the stack.


bool

built-in

Convert the item on the top of the stack to a Boolean value.

Discussion

For integers 0 is false and any other number is true; for lists the +empty list is false and all other lists are true.


branch

combinator built-in

Use a Boolean value to select and run one of two quoted programs.

   false [F] [T] branch
 --------------------------
           F
@@ -113,7 +113,7 @@ empty list is false and all other lists are true.

< T

Discussion

This is one of the fundamental operations (although it can be defined in terms of [choice] as above). The more common "if..then..else" construct -[ifte] adds a predicate function that is evaluated [nullary].


ccccons

   a b c d [...] ccccons
+[ifte] adds a predicate function that is evaluated [nullary].


ccccons

   a b c d [...] ccccons
 ---------------------------
        [a b c d ...]
 
@@ -170,7 +170,7 @@ and not all three possibilities, e.g.: [G] [EL] dup cmp [GE] [L] dupd cmp Or even: - [GL] [E] over cmp


codi

combinator

Take a quoted program from the stack, [cons] the next item onto it, then + [GL] [E] over cmp


codi

combinator

Take a quoted program from the stack, [cons] the next item onto it, then [dip] the whole thing under what was the third item on the stack.

   a b [F] . codi
 --------------------
@@ -184,7 +184,7 @@ as well as
 
   [a b c] [d e f] concat
 ----------------------------
        [a b c d e f]
-

cond

combinator

This combinator works like a case statement. It expects a single quote +


cond

combinator

This combinator works like a case statement. It expects a single quote on the stack that must contain zero or more condition quotes and a default quote. Each condition quote should contain a quoted predicate followed by the function expression to run if that predicate returns @@ -206,7 +206,7 @@ expressions, e.g.: ------------------ [a ...]

Discussion

Cons is a venerable old function from Lisp. -Its inverse operation is [uncons].


dinfrirst

combinator

Specialist function (that means I forgot what it does and why.)

Definition


dip

combinator built-in

The dip combinator expects a quoted program on the stack and below it +Its inverse operation is [uncons].


dinfrirst

combinator

Specialist function (that means I forgot what it does and why.)

Definition


dip

combinator built-in

The dip combinator expects a quoted program on the stack and below it some item, it hoists the item into the expression and runs the program on the rest of the stack.

   ... x [Q] . dip
@@ -224,22 +224,26 @@ Continuation-Passing Style.  The dip combinator could "set aside" t
 item and replace it after running Q but that means that there is an
 "extra space" where the item resides while Q runs.  One of the nice
 things about CPS is that the whole state is recorded in the stack and
-pending expression (not counting modifications to the dictionary.)


dipd

combinator

Like [dip] but expects two items.

+pending expression (not counting modifications to the dictionary.)


dipd

combinator

Like [dip] but expects two items.

   ... y x [Q] . dipd
 -------------------------
            ... . Q y x
-

Definition

Discussion

See [dip].


dipdd

combinator

Like [dip] but expects three items. :

-
   ... z y x [Q] . dip
+

Definition

Discussion

See [dip].


dipdd

combinator

Like [dip] but expects three items. :

+
   ... z y x [Q] . dipdd
 -----------------------------
              ... . Q z y x
-

Definition

Discussion

See [dip].


disenstacken

The disenstacken function expects a list on top of the stack and makes +

Definition

Discussion

See [dip].


dipddd

combinator

Like [dip] but expects four items. :

+
   ... z y x w [Q] . dipddd
+-------------------------------
+             ... . Q z y x w
+

Definition

Discussion

See [dip].


disenstacken

The disenstacken function expects a list on top of the stack and makes that the stack discarding the rest of the stack.

   1 2 3 [4 5 6] disenstacken
 --------------------------------
             6 5 4
 

Definition

Discussion

Note that the order of the list is not changed, it just looks that way because the stack is printed with the top on the right while lists are -printed with the top or head on the left.


div

built-in


divmod

    x y divmod
+printed with the top or head on the left.


div

built-in

Divide.


divmod

    x y divmod
 ------------------
      q      r
    (x/y)  (x%y)
@@ -260,7 +264,7 @@ items removed off the top.

   a dup
 -----------
     a a
-

dupd

[dup] the second item down on the stack.

+

dupd

[dup] the second item down on the stack.

   a b dupd
 --------------
     a a b
@@ -289,34 +293,27 @@ a F a
 -------------------------
        [c b a ...]
 

Definition

Discussion

This is a destructive version of [stack]. See the note under -[disenstacken] about the apparent but illusory reversal of the stack.


eq

built-in

Compare the two items on the top of the stack for equality and replace +[disenstacken] about the apparent but illusory reversal of the stack.


eq

built-in

Compare the two items on the top of the stack for equality and replace them with a Boolean value.

   a b eq
 -------------
    Boolean
    (a = b)
-

Definition

[false] [true] [false] cmp

first

built-in

Replace a list with its first item.

+

Definition

[false] [true] [false] cmp

first

built-in

Replace a list with its first item.

   [a ...]
 --------------
       a
-

Definition


first_two

Replace a list with its first two items.

+

Definition


first_two

Replace a list with its first two items.

   [a b ...] first_two
 -------------------------
            a b
-

flatten

Given a list of lists, concatinate them.

+

Definition


flatten

Given a list of lists, concatinate them.

Example

   [[1 2] [3 [4] 5] [6 7]] flatten
 -------------------------------------
           [1 2 3 [4] 5 6 7]
 

Definition

Discussion

Note that only one "level" of lists is flattened. In the example above -[4] is not unquoted.


floor

Return the largest integer \<= x.

Discussion

This function doesn't make sense (yet) to have because there are (as yet) -only integers in the system.


floordiv

I don't know why this is called "floor" div, I think it rounds its -result down (not towards zero or up.)

-
   a b floordiv
-------------------
-      (a/b)
-

Discussion

All the division commands need to be revisited when the "numeric tower" -for Thun gets nailed down.


fork

combinator

Run two quoted programs in parallel and replace them with their results.

+[4] is not unquoted.


fork

combinator

Run two quoted programs in parallel and replace them with their results.

   ... [F] [G] fork
 ----------------------
        ... f g
@@ -325,12 +322,12 @@ for Thun gets nailed down.

Definition


gcd

Take two integers from the stack and replace them with their Greatest -Common Denominator.

Definition

true [tuck mod dup 0 >] loop pop

Discussion

Euclid's Algorithm


gcd2

Compiled GCD function.

Discussion

See [gcd].


ge

built-in

Greater-than-or-equal-to comparison of two numbers.

+Common Denominator.

Definition

true [tuck mod dup 0 >] loop pop

Discussion

Euclid's Algorithm


ge

built-in

Greater-than-or-equal-to comparison of two numbers.

   a b ge
 --------------
    Boolean
    (a >= b)
-

Definition

[true] [true] [false] cmp

genrec

combinator

General Recursion Combinator.

+

Definition

[true] [true] [false] cmp

genrec

combinator

General Recursion Combinator.

                      [if] [then] [rec1] [rec2] genrec
 ---------------------------------------------------------------------
    [if] [then] [rec1 [[if] [then] [rec1] [rec2] genrec] rec2] ifte
@@ -393,15 +390,12 @@ It's part of the [app2] definition.

Definition

[true] [false] [false] cmp

help

Accepts a quoted symbol on the top of the stack and prints its +

Definition

[true] [false] [false] cmp

help

Accepts a quoted symbol on the top of the stack and prints its documentation.

   [foo] help
 ----------------
 

Discussion

Technically this is equivalent to pop, but it will only work if the -item on the top of the stack is a quoted symbol.


hypot

         x y hypot
----------------------------
-   sqrt(sqr(x) + sqr(y))
-

Definition

Discussion

This is another function that has to wait on the numeric tower.


i

combinator built-in

Append a quoted expression onto the pending expression.

+item on the top of the stack is a quoted symbol.


i

combinator built-in

Append a quoted expression onto the pending expression.

   [Q] . i
 -------------
        . Q
@@ -433,7 +427,7 @@ top item, then again with the top item.

1 9 1 2 3 4 [+] app2 ---------------------- - 1 2 5 6


infra

combinator

Accept a quoted program and a list on the stack and run the program with + 1 2 5 6


infra

combinator

Accept a quoted program and a list on the stack and run the program with the list as its stack. Does not affect the stack (below the list.)

   ... x y z [a b c] [Q] infra
 ---------------------------------
@@ -464,7 +458,7 @@ stack, replacing them with a Boolean value.

------------- Boolean (a <= b) -

Definition

[false] [true] [true] cmp

loop

combinator built-in

Expect a quoted program Q and a Boolean value on the stack. If the value is false +

Definition

[false] [true] [true] cmp

loop

combinator built-in

Expect a quoted program Q and a Boolean value on the stack. If the value is false discard the quoted program, otherwise run a copy of Q and loop again.

   false [Q] loop
 --------------------
@@ -493,7 +487,7 @@ stack, replacing them with a Boolean value.

------------- Boolean (a < b) -

Definition

[false] [false] [true] cmp

make_generator

Given an initial state value and a quoted generator function build a +

Definition

[false] [false] [true] cmp

make_generator

Given an initial state value and a quoted generator function build a generator quote.

   state [generator function] make_generator
 -----------------------------------------------
@@ -534,18 +528,17 @@ parallelism combinator due to the "pure" nature of the language.

   a b mul
 -------------
     (a×b)
-

ne

Not-Equal comparison of the two items on the top of the -stack, replacing them with a Boolean value.

-
   a b ne
--------------
-   Boolean
-   (a = b)
-

neg

Invert the sign of a number.

+

neg

Invert the sign of a number.

   a neg
 -----------
     -a
-

Definition


not

Like [bool] but convert the item on the top of the stack to the inverse -Boolean value.

+

Definition


neq

built-in

Not-Equal comparison of the two items on the top of the +stack, replacing them with a Boolean value.

+
   a b neq
+-------------
+   Boolean
+   (a = b)
+

Definition

[true] [false] [true] cmp

not

Invert the Boolean value on the top of the stack.

   true not
 --------------
     false
@@ -553,11 +546,13 @@ Boolean value.

false not --------------- true -

Definition

[true] [false] branch

nulco

Take the item on the top of the stack and [cons] it onto [nullary].

+

Definition

[true] [false] branch

nulco

Take the item on the top of the stack and [cons] it onto [nullary].

     [F] nulco
 -------------------
    [[F] nullary]
-

Definition

Discussion

Helper function for [or] and [and].


nullary

combinator

Run a quoted program without using any stack values and leave the first +

Definition

Discussion

Helper function for [or] and [and].


null

True if the item on the top of the stack is an empty list, +false if it's a list but not empty, +and an error if it's not a list.

Definition


nullary

combinator

Run a quoted program without using any stack values and leave the first item of the result on the stack.

   ... [P] nullary
 ---------------------
@@ -577,7 +572,7 @@ program.)


or

Logical bit-wise OR.

Definition


over

[dup] the second item on the stack over the first.

+

Definition


or

Logical bit-wise OR.

Definition


over

[dup] the second item on the stack over the first.

   a b over
 --------------
     a b a
@@ -606,7 +601,7 @@ the underlying [map] function is so implemented, of course.)

Definition

[+] [-] clop

pop

built-in

Pop the top item from the stack and discard it.

   a pop
 -----------
-

popd

[pop] the second item down on the stack.

+

popd

[pop] the second item down on the stack.

   a b popd
 --------------
       b
@@ -706,7 +701,7 @@ or the item isn't in the list then the list is unchanged.

See the "Remove Function" notebook.


rest

built-in

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

Definition


reverse

Reverse the list on the top of the stack.

+

Definition


reverse

Reverse the list on the top of the stack.

Example

   [1 2 3] reverse
 ---------------------
@@ -717,8 +712,7 @@ or the item isn't in the list then the list is unchanged.

Definition


rollup

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

Definition


round

Round a number to a given precision in decimal digits.

Discussion

Another one that won't make sense until the "numeric tower" is nailed -down.


rrest

   [a b ...] rrest
+

Definition


rrest

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

Definition


rshift

built-in

Logical Right-Shift

@@ -758,7 +752,9 @@ preserve order.

Definition


sort

Given a list return it sorted.

+

Definition


small

Return true if the item on the top of the stack is a list with zero or one item in it, +false if it is a list with more than one item in it, +and an error if it is not a list.

Definition


sort

Given a list return it sorted.

Example

   [4 2 5 7 1] sort
 ----------------------
@@ -782,19 +778,17 @@ list.

   n  sqr
 ------------
      n²
-

Definition


sqrt

Function Combinator

-

Return the square root of the number a. Negative numbers return complex -roots.

Discussion

Another "numeric tower" hatch...


stack

built-in

Put the stack onto the stack.

+

Definition


stack

built-in

Put the stack onto the stack.

      ... c b a stack
 ---------------------------
    ... c b a [a b c ...]
 

Discussion

This function forms a pair with [unstack], and together they form the -complement to the "destructive" pair [enstacken] and [disenstacken].


stackd

Grab the stack under the top item and put it onto the stack.

+complement to the "destructive" pair [enstacken] and [disenstacken].


stackd

Grab the stack under the top item and put it onto the stack.

Example

   ... 1 2 3 stackd
 ------------------------
   ... 1 2 [2 1 ...] 3
-

Definition


step

combinator

Run a quoted program on each item in a sequence.

+

Definition


step

combinator

Run a quoted program on each item in a sequence.

   ... [] [Q] step
 ---------------------
          ...
@@ -839,15 +833,15 @@ with the list, and put the old stack onto it.

-------------------------- 6 5 4 [3 2 1]

Discussion

This function works as a kind of "context switch". It's used in the -definition of [infra].


swap

built-in

Swap the top two items on the stack.

+definition of [infra].


swap

built-in

Swap the top two items on the stack.

   a b swap
 --------------
      b a
-

swapd

Swap the second and third items on the stack.

+

swapd

Swap the second and third items on the stack.

   a b c swapd
 -----------------
       b a c
-

Definition


swoncat

[concat] two lists, but [swap] the lists first.

Definition


swons

Like [cons] but [swap] the item and list.

+

Definition


swoncat

[concat] two lists, but [swap] the lists first.

Definition


swons

Like [cons] but [swap] the item and list.

   [...] a swons
 -------------------
       [a ...]
@@ -896,7 +890,7 @@ program n times.

This is a common pattern in Joy. You accept some parameters from the stack which typically include qouted programs and use them to build another program which does the actual work. This is kind of like macros -in Lisp, or preprocessor directives in C.

truthy

built-in

See bool.


tuck

[dup] the item on the top of the stack under the second item on the +in Lisp, or preprocessor directives in C.


tuck

[dup] the item on the top of the stack under the second item on the stack.

   a b tuck
 --------------
@@ -913,7 +907,7 @@ the list.  You cannot uncons an item from an empty list.

   [a ...] uncons
 --------------------
       a [...]
-

Definition

Discussion

This is the inverse of [cons].


unique

Given a list remove duplicate items.


unit

   a unit
+

Definition

Discussion

This is the inverse of [cons].


unique

Given a list remove duplicate items.


unit

   a unit
 ------------
     [a]
 

Definition

[] cons

unquoted

combinator

Unquote (using [i]) the list that is second on the stack.

@@ -921,7 +915,15 @@ the list. You cannot uncons an item from an empty list.

   1 2 [3 4] 5 unquoted
 --------------------------
          1 2 3 4 5
-

Definition

[i] dip

unswons

   [a ...] unswons
+

Definition

[i] dip

unstack

Take a list from the top of the stack and concat it to the stack.

+
joy? 1 2 3 [4 5 6]
+
+1 2 3 [4 5 6]
+
+joy? unstack
+
+1 2 3 6 5 4
+

Definition


unswons

   [a ...] unswons
 ---------------------
        [...] a
 

Definition


void

True if the form on TOS is void otherwise False.

Discussion

A form is any Joy expression composed solely of lists. @@ -942,7 +944,7 @@ the stack.

Definition

Discussion

The simplest recursive pattern. See the Recursion Combinators notebook. as well as -Recursion Theory and Joy by Manfred von


xor

Logical bit-wise eXclusive OR.

Definition

[] [not] branch

zip

Replace the two lists on the top of the stack with a list of the pairs +Recursion Theory and Joy by Manfred von


zip

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.

Example

   [1 2 3] [4 5 6] zip
diff --git a/docs/reference/Function-Reference.md b/docs/reference/Function-Reference.md
index 196fbfb..b5a3714 100644
--- a/docs/reference/Function-Reference.md
+++ b/docs/reference/Function-Reference.md
@@ -6,6 +6,30 @@ Version -10.0.0
 Each function, combinator, or definition should be documented here.
 
 
+------------------------------------------------------------------------
+
+## /\
+
+Binary Boolean *and*.
+
+### Crosslinks
+
+[bool]
+[not]
+[\/]
+
+------------------------------------------------------------------------
+
+## \/
+
+Binary Boolean *or*.
+
+### Crosslinks
+
+[bool]
+[not]
+[/\]
+
 ------------------------------------------------------------------------
 
 ## abs
@@ -390,13 +414,6 @@ the other way around.
 [select]
 
 
---------------
-
-## ^
-
-See [xor](#xor).
-
-
 ------------------------------------------------------------------------
 
 ## clear
@@ -648,13 +665,38 @@ Specialist function (that means I forgot what it does and why.)
 
 ------------------------------------------------------------------------
 
+## dipddd
+
+Combinator
+
+Like [dip] but expects four items. :
+
+       ... z y x w [Q] . dipddd
+    -------------------------------
+                 ... . Q z y x w
+
+### Discussion
+
+See [dip].
+
+### Crosslinks
+
+[dip]
+[dipd]
+[dipdd]
+[dupdip]
+[dupdipd]
+[infra]
+
+------------------------------------------------------------------------
+
 ## dipdd
 
 Combinator
 
 Like [dip] but expects three items. :
 
-       ... z y x [Q] . dip
+       ... z y x [Q] . dipdd
     -----------------------------
                  ... . Q z y x
 ### Discussion
@@ -665,11 +707,11 @@ See [dip].
 
 [dip]
 [dipd]
+[dipddd]
 [dupdip]
 [dupdipd]
 [infra]
 
-
 ------------------------------------------------------------------------
 
 ## dipd
@@ -690,6 +732,7 @@ See [dip].
 
 [dip]
 [dipdd]
+[dipddd]
 [dupdip]
 [dupdipd]
 [infra]
@@ -755,13 +798,13 @@ printed with the top or head on the left.
 
 [enstacken]
 [stack]
+[unstack]
 
-
---------------
+--------------------------------------------
 
 ## div
 
-See [floordiv](#floordiv).
+Divide.
 
 
 ------------------------------------------------------------------------
@@ -933,6 +976,7 @@ This is a destructive version of [stack].  See the note under
 
 [stack]
 [disenstacken]
+[unstack]
 
 
 ------------------------------------------------------------------------
@@ -954,7 +998,7 @@ them with a Boolean value.
 [gt]
 [le]
 [lt]
-[ne]
+[neq]
 
 
 --------------
@@ -968,7 +1012,7 @@ See [eq](#eq).
 
 ## !=
 
-See [ne](#ne).
+See [neq](#neq).
 
 
 ------------------------------------------------------------------------
@@ -1071,39 +1115,6 @@ Note that only one "level" of lists is flattened.  In the example above
 [zip]
 
 
-------------------------------------------------------------------------
-
-## floordiv
-
-I don't know why this is called "floor" div, I think it rounds its
-result down (not towards zero or up.)
-
-       a b floordiv
-    ------------------
-          (a/b)
-
-### Discussion
-
-All the division commands need to be revisited when the "numeric tower"
-for Thun gets nailed down.
-
-### Crosslinks
-
-[divmod]
-
-
-------------------------------------------------------------------------
-
-## floor
-
-Return the largest integer \<= x.
-
-### Discussion
-
-This function doesn't make sense (yet) to have because there are (as yet)
-only integers in the system.
-
-
 ------------------------------------------------------------------------
 
 ## fork
@@ -1145,21 +1156,6 @@ Replace a list with its fourth item.
 [rest]
 
 
-------------------------------------------------------------------------
-
-## gcd2
-
-Compiled GCD function.
-
-### Discussion
-
-See [gcd].
-
-### Crosslinks
-
-[gcd]
-
-
 ------------------------------------------------------------------------
 
 ## gcd
@@ -1190,7 +1186,7 @@ Greater-than-or-equal-to comparison of two numbers.
 [gt]
 [le]
 [lt]
-[ne]
+[neq]
 
 
 ------------------------------------------------------------------------
@@ -1374,7 +1370,7 @@ Greater-than comparison of two numbers.
 [ge]
 [le]
 [lt]
-[ne]
+[neq]
 
 ------------------------------------------------------------------------
 
@@ -1406,23 +1402,6 @@ See [pred](#pred).
 See [sub](#sub).
 
 
-------------------------------------------------------------------------
-
-## hypot
-
-             x y hypot
-    ---------------------------
-       sqrt(sqr(x) + sqr(y))
-
-### Discussion
-
-This is another function that has to wait on the numeric tower.
-
-### Crosslinks
-
-[sqrt]
-
-
 ------------------------------------------------------------------------
 
 ## id
@@ -1595,7 +1574,7 @@ stack, replacing them with a Boolean value.
 [ge]
 [gt]
 [lt]
-[ne]
+[neq]
 
 --------------
 
@@ -1608,7 +1587,7 @@ See [le](#le).
 
 ## <>
 
-See [ne](#ne).
+See [neq](#neq).
 
 
 ------------------------------------------------------------------------
@@ -1733,7 +1712,7 @@ stack, replacing them with a Boolean value.
 [ge]
 [gt]
 [le]
-[ne]
+[neq]
 
 ------------------------------------------------------------------------
 
@@ -1886,12 +1865,12 @@ Invert the sign of a number.
 
 ------------------------------------------------------------------------
 
-## ne
+## neq
 
 Not-Equal comparison of the two items on the top of the
 stack, replacing them with a Boolean value.
 
-       a b ne
+       a b neq
     -------------
        Boolean
        (a = b)
@@ -1909,8 +1888,7 @@ stack, replacing them with a Boolean value.
 
 ## not
 
-Like [bool] but convert the item on the top of the stack to the inverse
-Boolean value.
+Invert the Boolean value on the top of the stack.
 
        true not
     --------------
@@ -1924,7 +1902,6 @@ Boolean value.
 
 [bool]
 
-
 ------------------------------------------------------------------------
 
 ## nulco
@@ -1945,6 +1922,14 @@ Helper function for [or] and [and].
 [or]
 
 
+--------------------
+
+## null
+
+True if the item on the top of the stack is an empty list,
+false if it's a list but not empty,
+and an error if it's not a list.
+
 --------------------
 
 ## nullary
@@ -2006,7 +1991,6 @@ Logical bit-wise OR.
 ### Crosslinks
 
 [and]
-[xor]
 
 
 ------------------------------------------------------------------------
@@ -2532,18 +2516,6 @@ See [rolldown](#rolldown).
 [rolldown]
 
 
-------------------------------------------------------------------------
-
-## round
-
-Round a number to a given precision in decimal digits.
-
-### Discussion
-
-Another one that won't make sense until the "numeric tower" is nailed
-down.
-
-
 ------------------------------------------------------------------------
 
 ## rrest
@@ -2691,26 +2663,24 @@ Replace a list with its size.
                3
 
 
---------------
-
-## /floor
-
-See [floordiv](#floordiv).
-
-
 --------------
 
 ## /
 
-See [floordiv](#floordiv).
+See [div](#div).
 
 
---------------
+------------------------------------------------------------------------
 
-## //
+## small
 
-See [floordiv](#floordiv).
+Return `true` if the item on the top of the stack is a list with zero or one item in it,
+`false` if it is a list with more than one item in it,
+and an error if it is not a list.
 
+### Crosslinks
+
+[null]
 
 ------------------------------------------------------------------------
 
@@ -2792,20 +2762,6 @@ Square the number on the top of the stack.
     ------------
          n²
 
-------------------------------------------------------------------------
-
-## sqrt
-
-Function Combinator
-
-Return the square root of the number a. Negative numbers return complex
-roots.
-
-### Discussion
-
-Another "numeric tower" hatch...
-
-
 ------------------------------------------------------------------------
 
 ## stackd
@@ -2818,6 +2774,9 @@ Grab the stack under the top item and put it onto the stack.
     ------------------------
       ... 1 2 [2 1 ...] 3
 
+### Crosslinks
+
+[stack]
 
 ------------------------------------------------------------------------
 
@@ -2838,6 +2797,8 @@ complement to the "destructive" pair [enstacken] and [disenstacken].
 
 [enstacken]
 [disenstacken]
+[stackd]
+[unstack]
 
 
 ------------------------------------------------------------------------
@@ -3160,13 +3121,6 @@ another program which does the actual work.  This is kind of like macros
 in Lisp, or preprocessor directives in C.
 
 
---------------
-
-## truthy
-
-See [bool](#bool).
-
-
 ------------------------------------------------------------------------
 
 ## tuck
@@ -3245,6 +3199,26 @@ Given a list remove duplicate items.
 
 ------------------------------------------------------------------------
 
+## unstack
+
+Take a list from the top of the stack and `concat` it to the stack.
+
+    joy? 1 2 3 [4 5 6]
+    
+    1 2 3 [4 5 6]
+    
+    joy? unstack
+    
+    1 2 3 6 5 4
+
+### Crosslinks
+
+[stack]
+[disenstacken]
+[enstacken]
+
+------------------------------------------------------------------------
+
 ## unquoted
 
 Combinator
@@ -3377,20 +3351,6 @@ See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursi
 as well as
 [Recursion Theory and Joy](https://www.kevinalbrecht.com/code/joy-mirror/j05cmp.html) by Manfred von
 
-
-
-------------------------------------------------------------------------
-
-## xor
-
-Logical bit-wise eXclusive OR.
-
-### Crosslinks
-
-[and]
-[or]
-
-
 ------------------------------------------------------------------------
 
 ## zip
diff --git a/docs/reference/to_html.py b/docs/reference/to_html.py
index 8738e22..ce54218 100644
--- a/docs/reference/to_html.py
+++ b/docs/reference/to_html.py
@@ -64,7 +64,7 @@ dup swap pop clear
 add sub mul div rem remainder
 + - * / %
 concat
-truthy
+truthy bool
 inscribe
 < > >= <= != <> =
 gt lt ge le neq eq
diff --git a/implementations/defs.txt b/implementations/defs.txt
index 045f14f..c36137b 100644
--- a/implementations/defs.txt
+++ b/implementations/defs.txt
@@ -43,6 +43,7 @@ dupdipd dup dipd
 dupdip dupd dip
 enstacken stack [clear] dip
 first uncons pop
+first_two uncons first
 flatten <{} [concat] step
 fork [i] app2
 fourth rest third
@@ -50,7 +51,6 @@ gcd true [tuck mod dup 0 >] loop pop
 genrec [[genrec] ccccons] nullary swons concat ifte
 grabN <{} [cons] times
 grba [stack popd] dip
-hypot [sqr] ii + sqrt
 ifte [nullary] dipd swap branch
 ii [dip] dupdip i
 infra swons swaack [i] dip swaack
@@ -63,7 +63,7 @@ neg 0 swap -
 not [true] [false] branch
 nulco [nullary] cons
 nullary [stack] dinfrirst
-null [] swap concat bool not
+null _isnt_list bool not
 of swap at
 or nulco [nullary] dip [true] branch
 over [dup] dip swap
@@ -134,9 +134,9 @@ _mape popd reverse
 _map0 [_map1] dipd _map2
 _map1 stackd shift
 _map2 [infrst] cons dipd roll< swons
-_isnt_bool not not
+_isnt_bool [false] [true] branch
 _isnt_two_bools [_isnt_bool] ii
 _\/_ [_isnt_bool] [not] branch
 /\ _isnt_two_bools [pop false] [] branch
 \/ _isnt_two_bools [] [pop true] branch
-xor [] [not] branch
+_isnt_list [] swoncat