diff --git a/docs/html/FuncRef.html b/docs/html/FuncRef.html index 5e326d2..7422c66 100644 --- a/docs/html/FuncRef.html +++ b/docs/html/FuncRef.html @@ -1,6 +1,5 @@
Version -10.0.0
Each function, combinator, or definition should be documented here.
-## !- Function @@ -28,27 +27,22 @@ zero.
-## != See [ne](#ne).
-## % See [mod](#mod).
-## & See [and](#and). -
+
combinator
-## && -Combinator Short-circuiting Boolean AND @@ -87,67 +81,56 @@ This is seldom useful, I suspect, but this way you have it.
-## * See [mul](#mul).
-## + See [add](#add).
-## ++ See [succ](#succ).
-## - See [sub](#sub).
-## -- See [pred](#pred).
-## / See [floordiv](#floordiv).
-## // See [floordiv](#floordiv).
-## /floor See [floordiv](#floordiv).
-## < See [lt](#lt).
-## << See [lshift](#lshift).
-## <<{}
Function
@@ -172,19 +155,16 @@ Tuck an empty list just under the first two items on the stack.
-## <= See [le](#le).
-## <> See [ne](#ne).
-## <{}
Function
@@ -208,31 +188,26 @@ Tuck an empty list just under the first item on the stack.
-## = See [eq](#eq).
-## > See [gt](#gt).
-## >= See [ge](#ge).
-## >> See [rshift](#rshift).
-## ? Function @@ -253,13 +228,11 @@ consuming the item.
-## ^ See [xor](#xor).
-## abs Function @@ -271,17 +244,14 @@ Return the absolute value of the argument.
-## add -Basis Function +Function Add two numbers together: a + b. -
+
combinator
-## anamorphism -Combinator Build a list of values from a generator program `G` and a stopping predicate `P`. @@ -306,9 +276,8 @@ See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursi
-## and -Basis Function +Function Logical bit-wise AND. @@ -317,13 +286,11 @@ Logical bit-wise AND. [or](#or) [xor](#xor) -
+
combinator
-## app1 "apply one" -Combinator Given a quoted program on TOS and anything as the second stack item run the program without disturbing the stack and replace the two args with @@ -351,11 +318,9 @@ are more useful. [appN](#appN) [unary](#unary) -
+
combinator
-## app2 -Combinator Like [app1](#app1) with two items. @@ -387,11 +352,9 @@ should) be done. [appN](#appN) [unary](#unary) -
+
combinator
-## app3 -Combinator Like [app1] with three items. @@ -416,11 +379,9 @@ See [app2]. [appN](#appN) [unary](#unary) -
+
combinator
-## appN -Combinator Like [app1] with any number of items. @@ -450,13 +411,11 @@ function that many times on that many stack items. See also [app2].
-## at See [getitem](#getitem).
-## average Function @@ -478,11 +437,9 @@ As an exercise in Functional Programming in Joy it would be fun to convert this into a catamorphism. See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursion_Combinators.html). -
+
combinator
-## b -Combinator Run two quoted programs @@ -503,11 +460,9 @@ This combinator may seem trivial but it comes in handy. [dupdip](#dupdip) [ii](#ii) -
+
combinator
-## binary -Combinator Run a quoted program using exactly two stack values and leave the first item of the result on the stack. @@ -533,9 +488,8 @@ consuming exactly two items from the stack.
-## bool -Basis Function +Function Convert the item on the top of the stack to a Boolean value. @@ -548,11 +502,9 @@ empty list is `false` and all other lists are `true`. [not] -
+
combinator
-## branch -Basis Combinator Use a Boolean value to select and run one of two quoted programs. @@ -584,7 +536,6 @@ terms of [choice] as above). The more common "if..then..else" construct
-## ccccons Function @@ -604,7 +555,6 @@ Do [cons] four times.
-## ccons Function @@ -625,9 +575,8 @@ Do [cons] two times.
-## choice -Basis Function +Function Use a Boolean value to select one of two items. @@ -655,9 +604,8 @@ the other way around.
-## clear -Basis Function +Function Clear everything from the stack. @@ -670,11 +618,9 @@ Clear everything from the stack. [stack] [swaack] -
+
combinator
-## cleave -Combinator Run two programs in parallel, consuming one additional item, and put their results on the stack. @@ -703,11 +649,9 @@ One of a handful of useful parallel combinators. [fork] [map] -
+
combinator
-## clop -Combinator Run two programs in parallel, consuming two additional items, and put their results on the stack. @@ -733,11 +677,9 @@ Like [cleave] but consumes an additional item from the stack. [fork] [map] -
+
combinator
-## cmp -Combinator Take two values and three quoted programs on the stack and run one of the three depending on the results of comparing the two values. @@ -771,11 +713,9 @@ Or even: TODO: link to tree notebooks where this was used. -
+
combinator
-## 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. @@ -798,11 +738,9 @@ useful in a few places. [appN] [codireco] -
+
combinator
-## codireco -Combinator This is part of the [make_generator] function. You would not use this combinator directly. @@ -824,7 +762,6 @@ as well as
-## concat Function @@ -856,11 +793,9 @@ Concatinate two lists. [third] [zip] -
+
combinator
-## 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 @@ -893,9 +828,8 @@ expressions, e.g.:
-## cons -Basis Function +Function Given an item and a list, append the item to the list to make a new list. @@ -912,11 +846,9 @@ Its inverse operation is [uncons]. [uncons] -
+
combinator
-## dinfrirst -Combinator Specialist function (that means I forgot what it does and why.) @@ -924,11 +856,9 @@ Specialist function (that means I forgot what it does and why.) > [dip] [infrst] -
+
combinator
-## dip -Basis Combinator 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 @@ -963,11 +893,9 @@ pending expression (not counting modifications to the dictionary.) [dupdipd] [infra] -
+
combinator
-## dipd -Combinator Like [dip] but expects two items. @@ -986,11 +914,9 @@ See [dip]. [dupdip] [dupdipd] [infra] -
+
combinator
-## dipdd -Combinator Like [dip] but expects three items. : @@ -1011,7 +937,6 @@ See [dip].
-## disenstacken Function @@ -1040,13 +965,11 @@ printed with the top or head on the left.
-## div See [floordiv](#floordiv).
-## divmod Function @@ -1064,7 +987,6 @@ Invariant: `qy + r = x`.
-## down_to_zero Function @@ -1087,7 +1009,6 @@ zero) less than that onto the stack.
-## drop Function @@ -1110,9 +1031,8 @@ items removed off the top.
-## dup -Basis Function +Function "Dup"licate the top item on the stack. @@ -1129,7 +1049,6 @@ Basis Function
-## dupd Function @@ -1152,7 +1071,6 @@ Function
-## dupdd Function @@ -1173,11 +1091,9 @@ Function [dupdip] [dupdipd] -
+
combinator
-## dupdip -Combinator Apply a function `F` and [dup] the item under it on the stack. @@ -1206,11 +1122,9 @@ A very common and useful combinator. [dupdipd] -
+
combinator
-## dupdipd -Combinator Run a copy of program `F` under the next item down on the stack. @@ -1228,7 +1142,6 @@ Run a copy of program `F` under the next item down on the stack.
-## enstacken Function @@ -1256,9 +1169,8 @@ This is a destructive version of [stack]. See the note under
-## eq -Basis Function +Function Compare the two items on the top of the stack for equality and replace them with a Boolean value. @@ -1279,7 +1191,6 @@ them with a Boolean value.
-## first Function @@ -1302,7 +1213,6 @@ Replace a list with its first item.
-## first_two Function @@ -1326,7 +1236,6 @@ Replace a list with its first two items.
-## flatten Function @@ -1371,9 +1280,8 @@ Note that only one "level" of lists is flattened. In the example above
-## floor -Basis Function +Function Return the largest integer \<= x. @@ -1384,9 +1292,8 @@ only integers in the system.
-## floordiv -Basis Function +Function I don't know why this is called "floor" div, I think it rounds its result down (not towards zero or up.) @@ -1404,11 +1311,9 @@ for Thun gets nailed down. [divmod] -
+
combinator
-## fork -Combinator Run two quoted programs in parallel and replace them with their results. @@ -1432,7 +1337,6 @@ The basic parallelism combinator, the two programs are run independently.
-## fourth Function @@ -1455,7 +1359,6 @@ Replace a list with its fourth item.
-## gcd Function @@ -1472,7 +1375,6 @@ Euclid's Algorithm
-## gcd2 Function @@ -1488,9 +1390,8 @@ See [gcd].
-## ge -Basis Function +Function Greater-than-or-equal-to comparison of two numbers. @@ -1508,11 +1409,9 @@ Greater-than-or-equal-to comparison of two numbers. [lt] [ne] -
+
combinator
-## genrec -Combinator **Gen**eral **Rec**ursion Combinator. @@ -1581,7 +1480,6 @@ Tail recursive functions are those where `R2` is the `i` combinator:
-## getitem Function @@ -1627,7 +1525,6 @@ implementation-dependant.) [zip]
-## grabN
Function
@@ -1644,7 +1541,6 @@ Expect a number on the top of the stack and [cons] that many items from under it
> [\<\{\}] \[[cons]\] [times]
-## grba Function @@ -1670,9 +1566,8 @@ It's part of the [app2] definition. [app2]
-## gt -Basis Function +Function Greater-than comparison of two numbers. @@ -1691,7 +1586,6 @@ Greater-than comparison of two numbers. [ne]
-## help Function @@ -1708,7 +1602,6 @@ item on the top of the stack is a quoted symbol.
-## hypot Function @@ -1728,11 +1621,9 @@ This is another function that has to wait on the numeric tower. [sqrt] -
+
combinator
-## i -Basis Combinator Append a quoted expression onto the pending expression. @@ -1748,20 +1639,17 @@ example, the [x] combinator can be defined as `dup i`.
-## id -Basis Function +Function The identity function. ### Discussion Does nothing. It's kind of a mathematical thing, but it occasionally comes in handy. -
+
combinator
-## ifte -Combinator If-Then-Else combinator, a common and convenient specialization of [branch]. @@ -1778,11 +1666,9 @@ If-Then-Else combinator, a common and convenient specialization of [branch]. [branch] [loop] [while] -
+
combinator
-## ii -Combinator Take a quoted program from the stack and run it twice, first under the top item, then again with the top item. @@ -1825,11 +1711,9 @@ In some cases (like the example above) this is the same effect as using [app2] b [app2] [b] -
+
combinator
-## 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.) @@ -1864,11 +1748,9 @@ kind of "pocket universe". If the list represents a datastructure then [swaack](#swaack) -
+
combinator
-## infrst -Combinator Does [infra] and then extracts the [first] item from the resulting list. @@ -1878,7 +1760,6 @@ Does [infra] and then extracts the [first] item from the resulting list.
-## inscribe Create a new Joy function definition in the Joy dictionary. A definition is given as a quote with a name followed by a Joy expression. @@ -1895,9 +1776,8 @@ the `defs.txt` file. It can be abused, which you should avoid unless you know what you're doing.
-## le -Basis Function +Function Less-Than-or-Equal-to comparison of the two items on the top of the stack, replacing them with a Boolean value. @@ -1915,11 +1795,9 @@ stack, replacing them with a Boolean value. [gt] [lt] [ne] -
+
combinator
-## loop -Basis Combinator 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. @@ -1953,9 +1831,8 @@ Just as [branch] has it's more common and convenient form [ifte], [while]
-## lshift -Basis Function +Function [Logical Left-Shift](https://en.wikipedia.org/wiki/Logical_shift) @@ -1968,9 +1845,8 @@ Basis Function [rshift]
-## lt -Basis Function +Function Less-Than comparison of the two items on the top of the stack, replacing them with a Boolean value. @@ -1990,7 +1866,6 @@ stack, replacing them with a Boolean value. [ne]
-## make_generator Function @@ -2025,11 +1900,9 @@ See the ["Using `x` to Generate Values" notebook](https://joypy.osdn.io/notebook [codireco] -
+
combinator
-## map -Combinator Given a list of items and a quoted program run the program for each item in the list (with the rest of the stack) and replace the old list and the @@ -2056,9 +1929,8 @@ parallelism combinator due to the "pure" nature of the language.
-## max -Basis Function +Function Given a list find the maximum. @@ -2076,9 +1948,8 @@ Given a list find the maximum.
-## min -Basis Function +Function Given a list find the minimum. @@ -2096,9 +1967,8 @@ Given a list find the minimum.
-## mod -Basis Function +Function Return the remainder of `a` divided by `b`. @@ -2113,15 +1983,13 @@ Return the remainder of `a` divided by `b`.
-## modulus See [mod](#mod).
-## mul -Basis Function +Function Multiply two numbers. @@ -2136,9 +2004,8 @@ Multiply two numbers.
-## ne -Basis Function +Function Not-Equal comparison of the two items on the top of the stack, replacing them with a Boolean value. @@ -2158,7 +2025,6 @@ stack, replacing them with a Boolean value. [lt]
-## neg Function @@ -2173,7 +2039,6 @@ Invert the sign of a number.
-## not Function @@ -2198,7 +2063,6 @@ Boolean value.
-## nulco Function @@ -2221,11 +2085,9 @@ Helper function for [\|\|] and [&&]. [&&] [\|\|] -
+
combinator
-## nullary -Combinator Run a quoted program without using any stack values and leave the first item of the result on the stack. @@ -2261,7 +2123,6 @@ program.)
-## of Function @@ -2283,9 +2144,8 @@ Like [getitem] but [swap]s the order of arguments.
-## or -Basis Function +Function Logical bit-wise OR. @@ -2296,7 +2156,6 @@ Logical bit-wise OR.
-## over Function @@ -2330,11 +2189,9 @@ A fine old word from Forth. [tuck] -
+
combinator
-## pam -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 @@ -2361,13 +2218,11 @@ the underlying [map] function is so implemented, of course.)
-## pick See [getitem](#getitem).
-## pm Function @@ -2383,9 +2238,8 @@ Plus or minus. Replace two numbers with their sum and difference.
-## pop -Basis Function +Function Pop the top item from the stack and discard it. @@ -2403,7 +2257,6 @@ Pop the top item from the stack and discard it.
-## popd Function @@ -2428,7 +2281,6 @@ Function
-## popdd Function @@ -2453,7 +2305,6 @@ Function
-## popop Function @@ -2477,7 +2328,6 @@ Function
-## popopd Function @@ -2502,7 +2352,6 @@ Function
-## popopdd Function @@ -2525,7 +2374,6 @@ Function
-## popopop Function @@ -2549,9 +2397,8 @@ Function
-## pow -Basis Function +Function Take two numbers `a` and `n` from the stack and raise `a` to the `n`th power. (`n` is on the top of the stack.) @@ -2568,7 +2415,6 @@ power. (`n` is on the top of the stack.)
-## pred Function @@ -2582,11 +2428,9 @@ Predecessor. Decrement TOS. [succ] -
+
combinator
-## primrec -Combinator From the ["Overview of the language JOY"](https://www.kevinalbrecht.com/code/joy-mirror/j00ovr.html) @@ -2628,7 +2472,6 @@ Simple and useful specialization of the [genrec] combinator from the
-## product Function @@ -2646,7 +2489,6 @@ Or,
-## quoted Function @@ -2670,7 +2512,6 @@ This comes from the original Joy stuff.
-## range Function @@ -2701,7 +2542,6 @@ If `n` is less than 1 the resulting list is empty.
-## range_to_zero Function @@ -2729,7 +2569,6 @@ Note that the order is reversed compared to [range].
-## reco Function @@ -2750,19 +2589,16 @@ Replace the first item in a list with the item under it.
-## rem See [mod](#mod).
-## remainder See [mod](#mod).
-## remove Function @@ -2780,9 +2616,8 @@ See the ["Remove Function" notebook](https://osdn.net/projects/joypy/scm/git/Thu
-## rest
-Basis Function
+Function
[a ...] rest
------------------
@@ -2795,7 +2630,6 @@ Basis Function
-## reverse Function @@ -2813,19 +2647,16 @@ Reverse the list on the top of the stack.
-## roll< See [rolldown](#rolldown).
-## roll> See [rollup](#rollup).
-## rolldown Function @@ -2843,7 +2674,6 @@ Function
-## rollup Function @@ -2861,7 +2691,6 @@ Function
-## round Function @@ -2874,7 +2703,6 @@ down.
-## rrest Function @@ -2891,9 +2719,8 @@ Function
-## rshift -Basis Function +Function [Logical Right-Shift](https://en.wikipedia.org/wiki/Logical_shift) @@ -2906,7 +2733,6 @@ Basis Function [lshift]
-## run Function @@ -2924,7 +2750,6 @@ Run a quoted program in a list.
-## second Function @@ -2944,9 +2769,8 @@ Function
-## select -Basis Function +Function Use a Boolean value to select one of two items from a sequence. : @@ -2968,7 +2792,6 @@ The sequence can contain more than two items but not fewer.
-## sharing Function @@ -2985,7 +2808,6 @@ printing out the GPL notice.
-## shift Function @@ -3007,7 +2829,6 @@ Move the top item from one list to another.
-## shunt Function @@ -3036,7 +2857,6 @@ preserve order.
-## size Function @@ -3054,7 +2874,6 @@ Replace a list with its size.
-## sort Function @@ -3068,7 +2887,6 @@ Given a list return it sorted.
-## spiral_next Function @@ -3080,7 +2898,6 @@ See the ["Square Spiral Example Joy Code" notebook](https://joypy.osdn.io/notebo
-## split_at Function @@ -3109,7 +2926,6 @@ on the top of the stack.
-## split_list Function @@ -3136,7 +2952,6 @@ Compare with [split_at]. This function does extra work to ensure that
-## sqr Function @@ -3152,9 +2967,8 @@ Square the number on the top of the stack.
-## sqrt -Basis Function Combinator +Function Combinator Return the square root of the number a. Negative numbers return complex roots. @@ -3165,7 +2979,6 @@ Another "numeric tower" hatch...
-## stack Function @@ -3192,7 +3005,6 @@ complement to the "destructive" pair [enstacken] and [disenstacken].
-## stackd Function @@ -3208,11 +3020,9 @@ Grab the stack under the top item and put it onto the stack. > \[[stack]\] [dip] -
+
combinator
-## step -Combinator Run a quoted program on each item in a sequence. @@ -3238,11 +3048,9 @@ See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursi [step_zero] -
+
combinator
-## step_zero -Combinator Like [step] but with 0 as the initial value. @@ -3265,7 +3073,6 @@ Like [step] but with 0 as the initial value.
-## stuncons Function @@ -3283,7 +3090,6 @@ Take the [stack] and [uncons] the top item.
-## stununcons Function @@ -3305,9 +3111,8 @@ Take the [stack] and [uncons] the top two items.
-## sub -Basis Function +Function Subtract the number on the top of the stack from the number below it. @@ -3321,7 +3126,6 @@ Subtract the number on the top of the stack from the number below it.
-## succ Function @@ -3335,11 +3139,9 @@ Successor. Increment TOS. [pred] -
+
combinator
-## sum -Combinator Given a quoted sequence of numbers return the sum. @@ -3359,9 +3161,8 @@ Given a quoted sequence of numbers return the sum.
-## swaack -Basis Function +Function Swap stack. Take a list from the top of the stack, replace the stack with the list, and put the old stack onto it. @@ -3383,9 +3184,8 @@ definition of [infra].
-## swap -Basis Function +Function Swap the top two items on the stack. @@ -3399,7 +3199,6 @@ Swap the top two items on the stack.
-## swapd Function @@ -3420,7 +3219,6 @@ Swap the second and third items on the stack.
-## swoncat Function @@ -3436,7 +3234,6 @@ Function
-## swons Function @@ -3450,11 +3247,9 @@ Like [cons] but [swap] the item and list. > [swap] [cons] -
+
combinator
-## tailrec -Combinator A specialization of the [genrec] combinator. @@ -3477,7 +3272,6 @@ See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursi
-## take
Function
@@ -3492,11 +3286,9 @@ with just the top `n` items in reverse order.
> [\<\<\{\}] \[[shift]\] [times] [pop]
-+
combinator
-## ternary -Combinator Run a quoted program using exactly three stack values and leave the first item of the result on the stack. @@ -3522,7 +3314,6 @@ consuming exactly three items from the stack.
-## third Function @@ -3541,11 +3332,9 @@ Function [fourth] [rest] -
+
combinator
-## times -Combinator Expect a quoted program and an integer `n` on the stack and do the program `n` times. @@ -3589,13 +3378,11 @@ in Lisp, or preprocessor directives in C.
-## truthy See [bool](#bool).
-## tuck Function @@ -3616,7 +3403,6 @@ stack.
-## unary (Combinator) @@ -3644,9 +3430,8 @@ consuming exactly one item from the stack.
-## uncons -Basis Function +Function Removes an item from a list and leaves it on the stack under the rest of the list. You cannot `uncons` an item from an empty list. @@ -3665,7 +3450,6 @@ This is the inverse of [cons].
-## unique Function @@ -3673,7 +3457,6 @@ Given a list remove duplicate items.
-## unit Function @@ -3685,11 +3468,9 @@ Function > \[\] [cons] -
+
combinator
-## unquoted -Combinator Unquote (using [i]) the list that is second on the stack. @@ -3709,7 +3490,6 @@ Unquote (using [i]) the list that is second on the stack.
-## unswons Function @@ -3723,9 +3503,8 @@ Function
-## void -Basis Function +Function True if the form on TOS is void otherwise False. @@ -3737,17 +3516,14 @@ This represents a binary Boolean logical formula in the arithmetic of the
-## warranty -Basis Function +Function Print warranty information. -
+
combinator
-## while -Combinator A specialization of [loop] that accepts a quoted predicate program `P` and runs it [nullary]. @@ -3769,9 +3545,8 @@ and runs it [nullary].
-## words -Basis Function +Function Print all the words in alphabetical order. @@ -3783,11 +3558,9 @@ Mathematically this is a form of [id]. [help] -
+
combinator
-## x -Combinator Take a quoted function `F` and run it with itself as the first item on the stack. @@ -3811,9 +3584,8 @@ as well as
-## xor -Basis Function +Function Logical bit-wise eXclusive OR. @@ -3824,7 +3596,6 @@ Logical bit-wise eXclusive OR.
-## zip
Function
@@ -3836,11 +3607,9 @@ from each list. The smallest list sets the length of the result list.
[1 2 3] [4 5 6] zip
-------------------------
[[4 1] [5 2] [6 3]]
-+
combinator
-## || -Combinator Short-circuiting Boolean OR @@ -3870,7 +3639,6 @@ stack.) [&&](#section-1)
-## •
See [id](#id).
diff --git a/docs/html/css/func_ref.css b/docs/html/css/func_ref.css
index cf9820c..d33f775 100644
--- a/docs/html/css/func_ref.css
+++ b/docs/html/css/func_ref.css
@@ -49,3 +49,10 @@ a.self_link:hover {
.func_name {
font-family: monospace, 'Inconsolata';
}
+
+
+span.kind {
+ color: #fff;
+ background: #555;
+ padding: 0.1em;
+}
diff --git a/docs/reference/Function-Reference.md b/docs/reference/Function-Reference.md
index eac8d5c..97ff124 100644
--- a/docs/reference/Function-Reference.md
+++ b/docs/reference/Function-Reference.md
@@ -23,7 +23,7 @@ Return the absolute value of the argument.
## add
-Basis Function
+Function
Add two numbers together: a + b.
@@ -109,7 +109,7 @@ See the [Recursion Combinators notebook](https://joypy.osdn.io/notebooks/Recursi
## and
-Basis Function
+Function
Logical bit-wise AND.
@@ -352,7 +352,7 @@ This combinator may seem trivial but it comes in handy.
## bool
-Basis Function
+Function
Convert the item on the top of the stack to a Boolean value.
@@ -370,7 +370,7 @@ empty list is `false` and all other lists are `true`.
## branch
-Basis Combinator
+Combinator
Use a Boolean value to select and run one of two quoted programs.
@@ -455,7 +455,7 @@ Do [cons] two times.
## choice
-Basis Function
+Function
Use a Boolean value to select one of two items.
@@ -493,7 +493,7 @@ See [xor](#xor).
## clear
-Basis Function
+Function
Clear everything from the stack.
@@ -739,7 +739,7 @@ expressions, e.g.:
## cons
-Basis Function
+Function
Given an item and a list, append the item to the list to make a new list.
@@ -822,7 +822,7 @@ See [dip].
## dip
-Basis Combinator
+Combinator
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
@@ -1069,7 +1069,7 @@ Function
## dup
-Basis Function
+Function
"Dup"licate the top item on the stack.
@@ -1118,7 +1118,7 @@ This is a destructive version of [stack]. See the note under
## eq
-Basis Function
+Function
Compare the two items on the top of the stack for equality and replace
them with a Boolean value.
@@ -1280,7 +1280,7 @@ Note that only one "level" of lists is flattened. In the example above
## floordiv
-Basis Function
+Function
I don't know why this is called "floor" div, I think it rounds its
result down (not towards zero or up.)
@@ -1303,7 +1303,7 @@ for Thun gets nailed down.
## floor
-Basis Function
+Function
Return the largest integer \<= x.
@@ -1403,7 +1403,7 @@ Euclid's Algorithm
## ge
-Basis Function
+Function
Greater-than-or-equal-to comparison of two numbers.
@@ -1611,7 +1611,7 @@ See [gt](#gt).
## gt
-Basis Function
+Function
Greater-than comparison of two numbers.
@@ -1688,7 +1688,7 @@ This is another function that has to wait on the numeric tower.
## id
-Basis Function
+Function
The identity function.
@@ -1770,7 +1770,7 @@ In some cases (like the example above) this is the same effect as using [app2] b
## i
-Basis Combinator
+Combinator
Append a quoted expression onto the pending expression.
@@ -1860,7 +1860,7 @@ know what you're doing.
## le
-Basis Function
+Function
Less-Than-or-Equal-to comparison of the two items on the top of the
stack, replacing them with a Boolean value.
@@ -1962,7 +1962,7 @@ See [lt](#lt).
## loop
-Basis Combinator
+Combinator
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.
@@ -1999,7 +1999,7 @@ Just as [branch] has it's more common and convenient form [ifte],
## lshift
-Basis Function
+Function
[Logical Left-Shift](https://en.wikipedia.org/wiki/Logical_shift)
@@ -2015,7 +2015,7 @@ Basis Function
## lt
-Basis Function
+Function
Less-Than comparison of the two items on the top of the
stack, replacing them with a Boolean value.
@@ -2106,7 +2106,7 @@ parallelism combinator due to the "pure" nature of the language.
## max
-Basis Function
+Function
Given a list find the maximum.
@@ -2127,7 +2127,7 @@ Given a list find the maximum.
## min
-Basis Function
+Function
Given a list find the minimum.
@@ -2148,7 +2148,7 @@ Given a list find the minimum.
## mod
-Basis Function
+Function
Return the remainder of `a` divided by `b`.
@@ -2173,7 +2173,7 @@ See [mod](#mod).
## mul
-Basis Function
+Function
Multiply two numbers.
@@ -2207,7 +2207,7 @@ Invert the sign of a number.
## ne
-Basis Function
+Function
Not-Equal comparison of the two items on the top of the
stack, replacing them with a Boolean value.
@@ -2344,7 +2344,7 @@ Like [getitem] but [swap]s the order of arguments.
## or
-Basis Function
+Function
Logical bit-wise OR.
@@ -2522,7 +2522,7 @@ Function
## pop
-Basis Function
+Function
Pop the top item from the stack and discard it.
@@ -2643,7 +2643,7 @@ Function
## pow
-Basis Function
+Function
Take two numbers `a` and `n` from the stack and raise `a` to the `n`th
power. (`n` is on the top of the stack.)
@@ -2907,7 +2907,7 @@ See the ["Remove Function" notebook](https://osdn.net/projects/joypy/scm/git/Thu
## rest
-Basis Function
+Function
[a ...] rest
------------------
@@ -3026,7 +3026,7 @@ Function
## rshift
-Basis Function
+Function
[Logical Right-Shift](https://en.wikipedia.org/wiki/Logical_shift)
@@ -3082,7 +3082,7 @@ Function
## select
-Basis Function
+Function
Use a Boolean value to select one of two items from a sequence. :
@@ -3321,7 +3321,7 @@ Square the number on the top of the stack.
## sqrt
-Basis Function Combinator
+Function Combinator
Return the square root of the number a. Negative numbers return complex
roots.
@@ -3481,7 +3481,7 @@ Take the [stack] and [uncons] the top two items.
## sub
-Basis Function
+Function
Subtract the number on the top of the stack from the number below it.
@@ -3538,7 +3538,7 @@ Given a quoted sequence of numbers return the sum.
## swaack
-Basis Function
+Function
Swap stack. Take a list from the top of the stack, replace the stack
with the list, and put the old stack onto it.
@@ -3585,7 +3585,7 @@ Swap the second and third items on the stack.
## swap
-Basis Function
+Function
Swap the top two items on the stack.
@@ -3836,7 +3836,7 @@ consuming exactly one item from the stack.
## uncons
-Basis Function
+Function
Removes an item from a list and leaves it on the stack under the rest of
the list. You cannot `uncons` an item from an empty list.
@@ -3953,7 +3953,7 @@ stack.)
## void
-Basis Function
+Function
True if the form on TOS is void otherwise False.
@@ -3968,7 +3968,7 @@ This represents a binary Boolean logical formula in the arithmetic of the
## warranty
-Basis Function
+Function
Print warranty information.
@@ -4002,7 +4002,7 @@ and runs it [nullary].
## words
-Basis Function
+Function
Print all the words in alphabetical order.
@@ -4046,7 +4046,7 @@ as well as
## xor
-Basis Function
+Function
Logical bit-wise eXclusive OR.
diff --git a/docs/reference/to_html.py b/docs/reference/to_html.py
index c938451..43be074 100644
--- a/docs/reference/to_html.py
+++ b/docs/reference/to_html.py
@@ -27,14 +27,24 @@ def anchor_for(name):
else hashlib.sha256(name.encode()).hexdigest()
)
-
-d = {}
+anchors = {}
+sections = {}
for i, section in enumerate(k):
for line in section:
if line.startswith('## '):
name = line[3:].strip()
- d[name] = section
+ sections[name] = section
+ anchors[name] = anchor_for(name)
+ section.remove(line)
+ continue
+combinators = set(
+ name
+ for (name, section) in sections.items()
+ if 'Combinator' in section
+ )
+for name in combinators:
+ sections[name].remove('Combinator')
doc = HTML()
@@ -51,20 +61,22 @@ with doc.body as b:
b.p('Each function, combinator, or definition should be documented here.')
#b.hr
ul = b.ul
- for name, section in sorted(d.items()):
+ for name, section in sorted(sections.items()):
ul.li.a(name, href='#' + anchor_for(name))
ul += ' '
- for name, section in sorted(d.items()):
+ for name, section in sorted(sections.items()):
d = b.div
anchor_id = anchor_for(name)
title = d.h2(name, id=anchor_id, class_='func_name')
title += ' '
title.a('¶', href='#' + anchor_id, class_='self_link')
+ if name in combinators:
+ d.p.span('combinator', class_='kind')
d.pre('\n'.join(section))
html_string = '' + str(doc)
-print(html_string)
+print(html_string, file=open('../html/FuncRef.html', 'w'))
#from bs4 import BeautifulSoup
#print(BeautifulSoup(html_string, 'html.parser').prettify())