OSDN Git Service

Derive `zip`.
authorsforman <sforman@hushmail.com>
Mon, 9 Oct 2023 18:45:28 +0000 (11:45 -0700)
committersforman <sforman@hushmail.com>
Mon, 9 Oct 2023 18:45:28 +0000 (11:45 -0700)
docs/html/FuncRef.html
docs/html/notebooks/DeriveZip.html [new file with mode: 0644]
docs/reference/Function-Reference.md
docs/source/notebooks/DeriveZip.md [new file with mode: 0644]
implementations/scheme-chicken/defs.scm

index 68cca1b..856e805 100644 (file)
@@ -8,7 +8,7 @@
 ---------- n &gt;= 0
    true
 </code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">0 <a href="#92a00d7d91da9f0f06c3f218c49c9b98323469962b291365b85d3c16b6b7f95f">&gt;=</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Return a Boolean value indicating if a number is greater than or equal to
-zero.</p></div></div><div class="backlinks"><h3>Used By</h3><a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="c10987bd7cf853f6ea92ddac1b6c95fa830e3aee160cc5d4ba2fea3743be1aa2" class="func_name">!= <a href="#c10987bd7cf853f6ea92ddac1b6c95fa830e3aee160cc5d4ba2fea3743be1aa2" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#neq">neq</a>.</p></div></div><hr><div><h2 id="bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec" class="func_name">% <a href="#bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#mod">mod</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#divmod" class="func_name">divmod</a> <a href="#mod" class="func_name">mod</a></div></div><hr><div><h2 id="684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1" class="func_name">* <a href="#684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#mul">mul</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#lshift" class="func_name">lshift</a> <a href="#pow" class="func_name">pow</a> <a href="#product" class="func_name">product</a></div></div><hr><div><h2 id="a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b" class="func_name">+ <a href="#a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#add">add</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#cfc0c0607a3380f7975346b30c14af8284f5493d9781b0ed847f499f01b4768e" class="func_name">++</a> <a href="#pm" class="func_name">pm</a> <a href="#sum" class="func_name">sum</a></div></div><hr><div><h2 id="cfc0c0607a3380f7975346b30c14af8284f5493d9781b0ed847f499f01b4768e" class="func_name">++ <a href="#cfc0c0607a3380f7975346b30c14af8284f5493d9781b0ed847f499f01b4768e" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#succ">succ</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">1 <a href="#a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b">+</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#size" class="func_name">size</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112" class="func_name">- <a href="#3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#sub">sub</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c" class="func_name">--</a> <a href="#neg" class="func_name">neg</a> <a href="#pm" class="func_name">pm</a></div></div><hr><div><h2 id="d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c" class="func_name">-- <a href="#d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#pred">pred</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">1 <a href="#3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112">-</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#24eeb094bfbc05ab9fab7609e43f67a4b6f7f94db85bbab53d63ba083f006c9d" class="func_name">down_to_zero</a> <a href="#range" class="func_name">range</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1" class="func_name">/ <a href="#8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#div">div</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#average" class="func_name">average</a> <a href="#divmod" class="func_name">divmod</a> <a href="#rshift" class="func_name">rshift</a></div></div><hr><div><h2 id="c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="func_name">/\ <a href="#c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="self_link">¶</a></h2><p></p><div class="notes"><p>Binary Boolean <em>and</em>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#">_isnt_two_bools</a> [<a href="#pop">pop</a> false] [] <a href="#branch">branch</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#bool" class="func_name">bool</a> <a href="#not" class="func_name">not</a> <a href="#7a063e4cb04c8b9d833cec4caea5b184720eba13daf25139c99a355a266d921f" class="func_name">\/</a></div></div><hr><div><h2 id="dabd3aff769f07eb2965401eb029974ebba3407afd02b26ddb564ea5f8efae72" class="func_name">&lt; <a href="#dabd3aff769f07eb2965401eb029974ebba3407afd02b26ddb564ea5f8efae72" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#lt">lt</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#abs" class="func_name">abs</a></div></div><hr><div><h2 id="4be261c018f23deac37f17f24abb5f42c4f32044fa3116d7b618446fb03ca09e" class="func_name">&lt;&lt; <a href="#4be261c018f23deac37f17f24abb5f42c4f32044fa3116d7b618446fb03ca09e" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#lshift">lshift</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#lshift">lshift</a></div></div></div><hr><div><h2 id="c6484f3156f82b92eadb0aeb7423d93ebd37f15dbbe3538f82d8da2acabaa108" class="func_name">&lt;&lt;{} <a href="#c6484f3156f82b92eadb0aeb7423d93ebd37f15dbbe3538f82d8da2acabaa108" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   ... b a &lt;{}
+zero.</p></div></div><div class="backlinks"><h3>Used By</h3><a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="c10987bd7cf853f6ea92ddac1b6c95fa830e3aee160cc5d4ba2fea3743be1aa2" class="func_name">!= <a href="#c10987bd7cf853f6ea92ddac1b6c95fa830e3aee160cc5d4ba2fea3743be1aa2" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#neq">neq</a>.</p></div></div><hr><div><h2 id="bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec" class="func_name">% <a href="#bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#mod">mod</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#divmod" class="func_name">divmod</a> <a href="#mod" class="func_name">mod</a> <a href="#modulus" class="func_name">modulus</a></div></div><hr><div><h2 id="684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1" class="func_name">* <a href="#684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#mul">mul</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#lshift" class="func_name">lshift</a> <a href="#pow" class="func_name">pow</a> <a href="#product" class="func_name">product</a></div></div><hr><div><h2 id="a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b" class="func_name">+ <a href="#a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#add">add</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#cfc0c0607a3380f7975346b30c14af8284f5493d9781b0ed847f499f01b4768e" class="func_name">++</a> <a href="#pm" class="func_name">pm</a> <a href="#sum" class="func_name">sum</a></div></div><hr><div><h2 id="cfc0c0607a3380f7975346b30c14af8284f5493d9781b0ed847f499f01b4768e" class="func_name">++ <a href="#cfc0c0607a3380f7975346b30c14af8284f5493d9781b0ed847f499f01b4768e" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#succ">succ</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">1 <a href="#a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b">+</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#size" class="func_name">size</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112" class="func_name">- <a href="#3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#sub">sub</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c" class="func_name">--</a> <a href="#neg" class="func_name">neg</a> <a href="#pm" class="func_name">pm</a></div></div><hr><div><h2 id="d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c" class="func_name">-- <a href="#d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#pred">pred</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">1 <a href="#3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112">-</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#24eeb094bfbc05ab9fab7609e43f67a4b6f7f94db85bbab53d63ba083f006c9d" class="func_name">down_to_zero</a> <a href="#pred" class="func_name">pred</a> <a href="#range" class="func_name">range</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a> <a href="#succ" class="func_name">succ</a></div></div><hr><div><h2 id="8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1" class="func_name">/ <a href="#8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#div">div</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#average" class="func_name">average</a> <a href="#divmod" class="func_name">divmod</a> <a href="#rshift" class="func_name">rshift</a></div></div><hr><div><h2 id="c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="func_name">/\ <a href="#c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="self_link">¶</a></h2><p></p><div class="notes"><p>Binary Boolean <em>and</em>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#">_isnt_two_bools</a> [<a href="#pop">pop</a> false] [] <a href="#branch">branch</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#bool" class="func_name">bool</a> <a href="#not" class="func_name">not</a> <a href="#7a063e4cb04c8b9d833cec4caea5b184720eba13daf25139c99a355a266d921f" class="func_name">\/</a></div></div><hr><div><h2 id="dabd3aff769f07eb2965401eb029974ebba3407afd02b26ddb564ea5f8efae72" class="func_name">&lt; <a href="#dabd3aff769f07eb2965401eb029974ebba3407afd02b26ddb564ea5f8efae72" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#lt">lt</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#abs" class="func_name">abs</a></div></div><hr><div><h2 id="4be261c018f23deac37f17f24abb5f42c4f32044fa3116d7b618446fb03ca09e" class="func_name">&lt;&lt; <a href="#4be261c018f23deac37f17f24abb5f42c4f32044fa3116d7b618446fb03ca09e" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#lshift">lshift</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#lshift">lshift</a></div></div></div><hr><div><h2 id="c6484f3156f82b92eadb0aeb7423d93ebd37f15dbbe3538f82d8da2acabaa108" class="func_name">&lt;&lt;{} <a href="#c6484f3156f82b92eadb0aeb7423d93ebd37f15dbbe3538f82d8da2acabaa108" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   ... b a &lt;{}
 -----------------
    ... [] b a
 </code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[] <a href="#rollup">rollup</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Tuck an empty list just under the first two items on the stack.</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#7562cc288bc56648a8695b314d63d7e8a92eba12768b38c102fd7067877423e7" class="func_name">&lt;{}</a></div><div class="backlinks"><h3>Used By</h3><a href="#take" class="func_name">take</a></div></div><hr><div><h2 id="b60080dc8b8982d2a2bff6f8f3715c1939614dc553cd223ef21832b88c815866" class="func_name">&lt;= <a href="#b60080dc8b8982d2a2bff6f8f3715c1939614dc553cd223ef21832b88c815866" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#le">le</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#range" class="func_name">range</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="24295a9c545a402da4f2cc833dae7b4f3b80182f7f803516d580ca07c0642b64" class="func_name">&lt;&gt; <a href="#24295a9c545a402da4f2cc833dae7b4f3b80182f7f803516d580ca07c0642b64" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>See <a href="#neq">neq</a>.</p></div><div class="backlinks"><h3>Used By</h3><a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="7562cc288bc56648a8695b314d63d7e8a92eba12768b38c102fd7067877423e7" class="func_name">&lt;{} <a href="#7562cc288bc56648a8695b314d63d7e8a92eba12768b38c102fd7067877423e7" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   ... a &lt;{}
@@ -113,7 +113,7 @@ empty list is <code>false</code> and all other lists are <code>true</code>.</p><
              T
 </code></pre></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>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].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#choice" class="func_name">choice</a> <a href="#ifte" class="func_name">ifte</a> <a href="#select" class="func_name">select</a></div><div class="backlinks"><h3>Used By</h3><a href="#c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="func_name">/\</a> <a href="#7a063e4cb04c8b9d833cec4caea5b184720eba13daf25139c99a355a266d921f" class="func_name">\/</a> <a href="#abs" class="func_name">abs</a> <a href="#and" class="func_name">and</a> <a href="#ifte" class="func_name">ifte</a> <a href="#not" class="func_name">not</a> <a href="#or" class="func_name">or</a> <a href="#small" class="func_name">small</a></div></div><hr><div><h2 id="ccccons" class="func_name">ccccons <a href="#ccccons" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   a b c d [...] ccccons
+[ifte] adds a predicate function that is evaluated [nullary].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#choice" class="func_name">choice</a> <a href="#ifte" class="func_name">ifte</a> <a href="#select" class="func_name">select</a></div><div class="backlinks"><h3>Used By</h3><a href="#c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="func_name">/\</a> <a href="#7a063e4cb04c8b9d833cec4caea5b184720eba13daf25139c99a355a266d921f" class="func_name">\/</a> <a href="#abs" class="func_name">abs</a> <a href="#and" class="func_name">and</a> <a href="#choice" class="func_name">choice</a> <a href="#ifte" class="func_name">ifte</a> <a href="#not" class="func_name">not</a> <a href="#or" class="func_name">or</a> <a href="#small" class="func_name">small</a></div></div><hr><div><h2 id="ccccons" class="func_name">ccccons <a href="#ccccons" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   a b c d [...] ccccons
 ---------------------------
        [a b c d ...]
 </code></pre>
@@ -129,7 +129,7 @@ terms of [choice] as above).  The more common "if..then..else" construct
    a b true choice
 ---------------------
           b
-</code></pre></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>It's a matter of taste whether you implement this in terms of [branch] or
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#pop">pop</a>] [<a href="#popd">popd</a>] <a href="#branch">branch</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>It's a matter of taste whether you implement this in terms of [branch] or
 the other way around.</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#branch" class="func_name">branch</a> <a href="#select" class="func_name">select</a></div></div><hr><div><h2 id="clear" class="func_name">clear <a href="#clear" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>Clear everything from the stack.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[] <a href="#swaack">swaack</a> <a href="#pop">pop</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#stack" class="func_name">stack</a> <a href="#swaack" class="func_name">swaack</a></div><div class="backlinks"><h3>Used By</h3><a href="#enstacken" class="func_name">enstacken</a></div></div><hr><div><h2 id="cleave" class="func_name">cleave <a href="#cleave" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Run two programs in parallel, consuming one additional item, and put their
 results on the stack.</p>
 <pre><code>   ... x [A] [B] cleave
@@ -206,7 +206,7 @@ expressions, e.g.:
 ------------------
      [a ...]
 </code></pre></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Cons is a <a href="https://en.wikipedia.org/wiki/Cons#Lists">venerable old function from Lisp</a>.
-Its inverse operation is [uncons].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#uncons" class="func_name">uncons</a></div><div class="backlinks"><h3>Used By</h3><a href="#d5856351bbc14599e687dac105150e8a919b21477f3c00386405228caac1e43a" class="func_name">app2</a> <a href="#ccons" class="func_name">ccons</a> <a href="#codi" class="func_name">codi</a> <a href="#dipdd" class="func_name">dipdd</a> <a href="#dipddd" class="func_name">dipddd</a> <a href="#grabN" class="func_name">grabN</a> <a href="#map" class="func_name">map</a> <a href="#nulco" class="func_name">nulco</a> <a href="#pow" class="func_name">pow</a> <a href="#reco" class="func_name">reco</a> <a href="#swons" class="func_name">swons</a> <a href="#unit" class="func_name">unit</a></div></div><hr><div><h2 id="dinfrirst" class="func_name">dinfrirst <a href="#dinfrirst" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Specialist function (that means I forgot what it does and why.)</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#dip">dip</a> <a href="#infrst">infrst</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#nullary" class="func_name">nullary</a></div></div><hr><div><h2 id="dip" class="func_name">dip <a href="#dip" class="self_link">¶</a></h2><p><span class="kind">combinator</span> <span class="kind">built-in</span></p><div class="notes"><p>The <code>dip</code> combinator expects a quoted program on the stack and below it
+Its inverse operation is [uncons].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#uncons" class="func_name">uncons</a></div><div class="backlinks"><h3>Used By</h3><a href="#d5856351bbc14599e687dac105150e8a919b21477f3c00386405228caac1e43a" class="func_name">app2</a> <a href="#ccons" class="func_name">ccons</a> <a href="#codi" class="func_name">codi</a> <a href="#dipdd" class="func_name">dipdd</a> <a href="#dipddd" class="func_name">dipddd</a> <a href="#grabN" class="func_name">grabN</a> <a href="#map" class="func_name">map</a> <a href="#nulco" class="func_name">nulco</a> <a href="#pow" class="func_name">pow</a> <a href="#" class="func_name">quote-two</a> <a href="#reco" class="func_name">reco</a> <a href="#swons" class="func_name">swons</a> <a href="#unit" class="func_name">unit</a> <a href="#zip" class="func_name">zip</a></div></div><hr><div><h2 id="dinfrirst" class="func_name">dinfrirst <a href="#dinfrirst" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Specialist function (that means I forgot what it does and why.)</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#dip">dip</a> <a href="#infrst">infrst</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#nullary" class="func_name">nullary</a></div></div><hr><div><h2 id="dip" class="func_name">dip <a href="#dip" class="self_link">¶</a></h2><p><span class="kind">combinator</span> <span class="kind">built-in</span></p><div class="notes"><p>The <code>dip</code> 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. </p>
 <pre><code>   ... x [Q] . dip
@@ -228,7 +228,7 @@ pending expression (not counting modifications to the dictionary.)</p></div></di
 <pre><code>   ... y x [Q] . dipd
 -------------------------
            ... . Q y x
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#dip">dip</a>] <a href="#codi">codi</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>See [dip].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#dip" class="func_name">dip</a> <a href="#dipdd" class="func_name">dipdd</a> <a href="#dipddd" class="func_name">dipddd</a> <a href="#dupdip" class="func_name">dupdip</a> <a href="#dupdipd" class="func_name">dupdipd</a> <a href="#infra" class="func_name">infra</a></div><div class="backlinks"><h3>Used By</h3><a href="#cmp" class="func_name">cmp</a> <a href="#dipdd" class="func_name">dipdd</a> <a href="#dipddd" class="func_name">dipddd</a> <a href="#dupdd" class="func_name">dupdd</a> <a href="#dupdipd" class="func_name">dupdipd</a> <a href="#ifte" class="func_name">ifte</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popopdd" class="func_name">popopdd</a></div></div><hr><div><h2 id="dipdd" class="func_name">dipdd <a href="#dipdd" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Like [dip] but expects three items. :</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#dip">dip</a>] <a href="#codi">codi</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>See [dip].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#dip" class="func_name">dip</a> <a href="#dipdd" class="func_name">dipdd</a> <a href="#dipddd" class="func_name">dipddd</a> <a href="#dupdip" class="func_name">dupdip</a> <a href="#dupdipd" class="func_name">dupdipd</a> <a href="#infra" class="func_name">infra</a></div><div class="backlinks"><h3>Used By</h3><a href="#cmp" class="func_name">cmp</a> <a href="#dipdd" class="func_name">dipdd</a> <a href="#dipddd" class="func_name">dipddd</a> <a href="#dupdd" class="func_name">dupdd</a> <a href="#dupdipd" class="func_name">dupdipd</a> <a href="#ifte" class="func_name">ifte</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popopdd" class="func_name">popopdd</a> <a href="#" class="func_name">uncons-pair</a></div></div><hr><div><h2 id="dipdd" class="func_name">dipdd <a href="#dipdd" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Like [dip] but expects three items. :</p>
 <pre><code>   ... z y x [Q] . dipdd
 -----------------------------
              ... . Q z y x
@@ -303,7 +303,7 @@ them with a Boolean value.</p>
 <pre><code>   [a ...]
 --------------
       a
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#uncons">uncons</a> <a href="#pop">pop</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#second" class="func_name">second</a> <a href="#third" class="func_name">third</a> <a href="#fourth" class="func_name">fourth</a> <a href="#rest" class="func_name">rest</a></div><div class="backlinks"><h3>Used By</h3><a href="#at" class="func_name">at</a> <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two</a> <a href="#infrst" class="func_name">infrst</a> <a href="#second" class="func_name">second</a> <a href="#uncons" class="func_name">uncons</a></div></div><hr><div><h2 id="07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="self_link">¶</a></h2><p></p><div class="notes"><p>Replace a list with its first two items.</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#uncons">uncons</a> <a href="#pop">pop</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#second" class="func_name">second</a> <a href="#third" class="func_name">third</a> <a href="#fourth" class="func_name">fourth</a> <a href="#rest" class="func_name">rest</a></div><div class="backlinks"><h3>Used By</h3><a href="#at" class="func_name">at</a> <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two</a> <a href="#getitem" class="func_name">getitem</a> <a href="#infrst" class="func_name">infrst</a> <a href="#second" class="func_name">second</a> <a href="#uncons" class="func_name">uncons</a></div></div><hr><div><h2 id="07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="self_link">¶</a></h2><p></p><div class="notes"><p>Replace a list with its first two items.</p>
 <pre><code>   [a b ...] first_two
 -------------------------
            a b
@@ -366,15 +366,15 @@ Tail recursive functions are those where <code>R2</code> is the <code>i</code> c
     P == [I] [T] [R] tailrec
       == [I] [T] [R [P] i] ifte
       == [I] [T] [R P] ifte</p>
-</blockquote></div></div><div class="crosslinks"><h3>See Also</h3><a href="#anamorphism" class="func_name">anamorphism</a> <a href="#tailrec" class="func_name">tailrec</a> <a href="#x" class="func_name">x</a></div><div class="backlinks"><h3>Used By</h3><a href="#anamorphism" class="func_name">anamorphism</a> <a href="#genrec" class="func_name">genrec</a> <a href="#tailrec" class="func_name">tailrec</a></div></div><hr><div><h2 id="getitem" class="func_name">getitem <a href="#getitem" class="self_link">¶</a></h2><p></p><div class="notes"><p>Expects an integer and a quote on the stack and returns the item at the
+</blockquote></div></div><div class="crosslinks"><h3>See Also</h3><a href="#anamorphism" class="func_name">anamorphism</a> <a href="#tailrec" class="func_name">tailrec</a> <a href="#x" class="func_name">x</a></div><div class="backlinks"><h3>Used By</h3><a href="#anamorphism" class="func_name">anamorphism</a> <a href="#genrec" class="func_name">genrec</a> <a href="#tailrec" class="func_name">tailrec</a> <a href="#zip" class="func_name">zip</a></div></div><hr><div><h2 id="getitem" class="func_name">getitem <a href="#getitem" class="self_link">¶</a></h2><p></p><div class="notes"><p>Expects an integer and a quote on the stack and returns the item at the
 nth position in the quote counting from 0.</p>
 <h3>Example</h3>
 <pre><code>   [a b c d] 2 getitem
 -------------------------
         c
-</code></pre></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>If the number isn't a valid index into the quote <code>getitem</code> will cause
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#rest">rest</a>] <a href="#times">times</a> <a href="#first">first</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>If the number isn't a valid index into the quote <code>getitem</code> will cause
 some sort of problem (the exact nature of which is
-implementation-dependant.)</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#concat" class="func_name">concat</a> <a href="#first" class="func_name">first</a> <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two</a> <a href="#flatten" class="func_name">flatten</a> <a href="#fourth" class="func_name">fourth</a> <a href="#remove" class="func_name">remove</a> <a href="#rest" class="func_name">rest</a> <a href="#reverse" class="func_name">reverse</a> <a href="#rrest" class="func_name">rrest</a> <a href="#second" class="func_name">second</a> <a href="#shift" class="func_name">shift</a> <a href="#shunt" class="func_name">shunt</a> <a href="#size" class="func_name">size</a> <a href="#sort" class="func_name">sort</a> <a href="#11410ec2e9e5af6b7643845e3382d79fd07d4518548586894c0201f69e98447c" class="func_name">split_at</a> <a href="#ba4c8ebb56beba87283248c7ef9ea77b0cf1d215cd283aa0c9fa0a3e971e8415" class="func_name">split_list</a> <a href="#swaack" class="func_name">swaack</a> <a href="#third" class="func_name">third</a> <a href="#zip" class="func_name">zip</a></div></div><hr><div><h2 id="grabN" class="func_name">grabN <a href="#grabN" class="self_link">¶</a></h2><p></p><div class="notes"><p>Expect a number on the top of the stack and [cons] that many items from under it onto a new list.</p>
+implementation-dependant.)</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#concat" class="func_name">concat</a> <a href="#first" class="func_name">first</a> <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two</a> <a href="#flatten" class="func_name">flatten</a> <a href="#fourth" class="func_name">fourth</a> <a href="#remove" class="func_name">remove</a> <a href="#rest" class="func_name">rest</a> <a href="#reverse" class="func_name">reverse</a> <a href="#rrest" class="func_name">rrest</a> <a href="#second" class="func_name">second</a> <a href="#shift" class="func_name">shift</a> <a href="#shunt" class="func_name">shunt</a> <a href="#size" class="func_name">size</a> <a href="#sort" class="func_name">sort</a> <a href="#11410ec2e9e5af6b7643845e3382d79fd07d4518548586894c0201f69e98447c" class="func_name">split_at</a> <a href="#ba4c8ebb56beba87283248c7ef9ea77b0cf1d215cd283aa0c9fa0a3e971e8415" class="func_name">split_list</a> <a href="#swaack" class="func_name">swaack</a> <a href="#third" class="func_name">third</a> <a href="#zip" class="func_name">zip</a></div><div class="backlinks"><h3>Used By</h3><a href="#pick" class="func_name">pick</a></div></div><hr><div><h2 id="grabN" class="func_name">grabN <a href="#grabN" class="self_link">¶</a></h2><p></p><div class="notes"><p>Expect a number on the top of the stack and [cons] that many items from under it onto a new list.</p>
 <h3>Example</h3>
 <pre><code>   a b c d e 3 grabN
 -----------------------
@@ -400,7 +400,7 @@ item on the top of the stack is a quoted symbol.</p></div></div></div><hr><div><
 -------------
        . Q
 </code></pre></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>This is a fundamental combinator.  It is used in all kinds of places.  For
-example, the [x] combinator can be defined as <code>dup i</code>.</p></div></div><div class="backlinks"><h3>Used By</h3><a href="#b" class="func_name">b</a> <a href="#fork" class="func_name">fork</a> <a href="#ii" class="func_name">ii</a> <a href="#infra" class="func_name">infra</a> <a href="#pam" class="func_name">pam</a> <a href="#tailrec" class="func_name">tailrec</a> <a href="#unquoted" class="func_name">unquoted</a> <a href="#x" class="func_name">x</a></div></div><hr><div><h2 id="id" class="func_name">id <a href="#id" class="self_link">¶</a></h2><p></p><div class="notes"><p>The identity function.</p></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Does nothing.  It's kind of a mathematical thing, but it occasionally comes in handy.</p></div></div></div><hr><div><h2 id="ifte" class="func_name">ifte <a href="#ifte" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>If-Then-Else combinator, a common and convenient specialization of [branch].</p>
+example, the [x] combinator can be defined as <code>dup i</code>.</p></div></div><div class="backlinks"><h3>Used By</h3><a href="#b" class="func_name">b</a> <a href="#fork" class="func_name">fork</a> <a href="#ii" class="func_name">ii</a> <a href="#infra" class="func_name">infra</a> <a href="#pam" class="func_name">pam</a> <a href="#tailrec" class="func_name">tailrec</a> <a href="#unquoted" class="func_name">unquoted</a> <a href="#x" class="func_name">x</a> <a href="#zip" class="func_name">zip</a></div></div><hr><div><h2 id="id" class="func_name">id <a href="#id" class="self_link">¶</a></h2><p></p><div class="notes"><p>The identity function.</p></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Does nothing.  It's kind of a mathematical thing, but it occasionally comes in handy.</p></div></div></div><hr><div><h2 id="ifte" class="func_name">ifte <a href="#ifte" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>If-Then-Else combinator, a common and convenient specialization of [branch].</p>
 <pre><code>        [if] [then] [else] ifte
 ---------------------------------------
    [if] nullary [else] [then] branch
@@ -427,7 +427,7 @@ top item, then again with the top item.</p>
             1 9
        1 2 3 4 [+] app2
     ----------------------
-           1 2 5 6</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#d5856351bbc14599e687dac105150e8a919b21477f3c00386405228caac1e43a" class="func_name">app2</a> <a href="#b" class="func_name">b</a></div><div class="backlinks"><h3>Used By</h3><a href="#d5856351bbc14599e687dac105150e8a919b21477f3c00386405228caac1e43a" class="func_name">app2</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a></div></div><hr><div><h2 id="infra" class="func_name">infra <a href="#infra" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Accept a quoted program and a list on the stack and run the program with
+           1 2 5 6</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#d5856351bbc14599e687dac105150e8a919b21477f3c00386405228caac1e43a" class="func_name">app2</a> <a href="#b" class="func_name">b</a></div><div class="backlinks"><h3>Used By</h3><a href="#d5856351bbc14599e687dac105150e8a919b21477f3c00386405228caac1e43a" class="func_name">app2</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a> <a href="#" class="func_name">uncons-two</a></div></div><hr><div><h2 id="infra" class="func_name">infra <a href="#infra" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>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.)</p>
 <pre><code>   ... x y z [a b c] [Q] infra
 ---------------------------------
@@ -524,7 +524,7 @@ parallelism combinator due to the "pure" nature of the language.</p></div></div>
 <pre><code>   a b mod
 -------------
     (a%b)
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec">%</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#divmod" class="func_name">divmod</a> <a href="#mul" class="func_name">mul</a></div><div class="backlinks"><h3>Used By</h3><a href="#gcd" class="func_name">gcd</a></div></div><hr><div><h2 id="modulus" class="func_name">modulus <a href="#modulus" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#mod">mod</a>.</p></div></div><hr><div><h2 id="mul" class="func_name">mul <a href="#mul" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>Multiply two numbers.</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec">%</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#divmod" class="func_name">divmod</a> <a href="#mul" class="func_name">mul</a></div><div class="backlinks"><h3>Used By</h3><a href="#gcd" class="func_name">gcd</a></div></div><hr><div><h2 id="modulus" class="func_name">modulus <a href="#modulus" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#mod">mod</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#bbf3f11cb5b43e700273a78d12de55e4a7eab741ed2abf13787a4d2dc832b8ec">%</a></div></div></div><hr><div><h2 id="mul" class="func_name">mul <a href="#mul" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>Multiply two numbers.</p>
 <pre><code>   a b mul
 -------------
     (a×b)
@@ -552,7 +552,7 @@ stack, replacing them with a Boolean value.</p>
    [[F] nullary]
 </code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#nullary">nullary</a>] <a href="#cons">cons</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Helper function for [or] and [and].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#and" class="func_name">and</a> <a href="#or" class="func_name">or</a></div><div class="backlinks"><h3>Used By</h3><a href="#and" class="func_name">and</a> <a href="#or" class="func_name">or</a> <a href="#while" class="func_name">while</a></div></div><hr><div><h2 id="null" class="func_name">null <a href="#null" class="self_link">¶</a></h2><p></p><div class="notes"><p>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.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#">_isnt_list</a> <a href="#bool">bool</a> <a href="#not">not</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#small" class="func_name">small</a></div></div><hr><div><h2 id="nullary" class="func_name">nullary <a href="#nullary" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Run a quoted program without using any stack values and leave the first
+and an error if it's not a list.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#">_isnt_list</a> <a href="#bool">bool</a> <a href="#not">not</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#small" class="func_name">small</a> <a href="#zip" class="func_name">zip</a></div></div><hr><div><h2 id="nullary" class="func_name">nullary <a href="#nullary" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Run a quoted program without using any stack values and leave the first
 item of the result on the stack.</p>
 <pre><code>   ... [P] nullary
 ---------------------
@@ -594,18 +594,18 @@ rest of the stack.)</p>
 -------------------------------
       5 7 [12 -2 35 0 5]
 </code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#i">i</a>] <a href="#map">map</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>A specialization of [map] that runs a list of functions in parallel (if
-the underlying [map] function is so implemented, of course.)</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#map" class="func_name">map</a></div></div><hr><div><h2 id="pick" class="func_name">pick <a href="#pick" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#getitem">getitem</a>.</p></div></div><hr><div><h2 id="pm" class="func_name">pm <a href="#pm" class="self_link">¶</a></h2><p></p><div class="notes"><p>Plus or minus.  Replace two numbers with their sum and difference.</p>
+the underlying [map] function is so implemented, of course.)</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#map" class="func_name">map</a></div></div><hr><div><h2 id="pick" class="func_name">pick <a href="#pick" class="self_link">¶</a></h2><p></p><div class="notes"><p>See <a href="#getitem">getitem</a>.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#getitem">getitem</a></div></div></div><hr><div><h2 id="pm" class="func_name">pm <a href="#pm" class="self_link">¶</a></h2><p></p><div class="notes"><p>Plus or minus.  Replace two numbers with their sum and difference.</p>
 <pre><code>      a b pm
 -----------------
    (a+b) (a-b)
 </code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#a318c24216defe206feeb73ef5be00033fa9c4a74d0b967f6532a26ca5906d3b">+</a>] [<a href="#3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112">-</a>] <a href="#clop">clop</a></div></div></div><hr><div><h2 id="pop" class="func_name">pop <a href="#pop" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><p>Pop the top item from the stack and discard it.</p>
 <pre><code>   a pop
 -----------
-</code></pre></div><div class="crosslinks"><h3>See Also</h3><a href="#popd" class="func_name">popd</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popop" class="func_name">popop</a> <a href="#popopd" class="func_name">popopd</a> <a href="#popopdd" class="func_name">popopdd</a> <a href="#popopop" class="func_name">popopop</a></div><div class="backlinks"><h3>Used By</h3><a href="#c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="func_name">/\</a> <a href="#7a063e4cb04c8b9d833cec4caea5b184720eba13daf25139c99a355a266d921f" class="func_name">\/</a> <a href="#anamorphism" class="func_name">anamorphism</a> <a href="#clear" class="func_name">clear</a> <a href="#disenstacken" class="func_name">disenstacken</a> <a href="#first" class="func_name">first</a> <a href="#gcd" class="func_name">gcd</a> <a href="#popd" class="func_name">popd</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popop" class="func_name">popop</a> <a href="#popopop" class="func_name">popopop</a> <a href="#size" class="func_name">size</a> <a href="#small" class="func_name">small</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a> <a href="#take" class="func_name">take</a> <a href="#unstack" class="func_name">unstack</a></div></div><hr><div><h2 id="popd" class="func_name">popd <a href="#popd" class="self_link">¶</a></h2><p></p><div class="notes"><p>[pop] the second item down on the stack.</p>
+</code></pre></div><div class="crosslinks"><h3>See Also</h3><a href="#popd" class="func_name">popd</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popop" class="func_name">popop</a> <a href="#popopd" class="func_name">popopd</a> <a href="#popopdd" class="func_name">popopdd</a> <a href="#popopop" class="func_name">popopop</a></div><div class="backlinks"><h3>Used By</h3><a href="#c1773bc23efd62ebecd69d025d1561e8fc864159ba2fc48177060e4b376112b5" class="func_name">/\</a> <a href="#7a063e4cb04c8b9d833cec4caea5b184720eba13daf25139c99a355a266d921f" class="func_name">\/</a> <a href="#anamorphism" class="func_name">anamorphism</a> <a href="#choice" class="func_name">choice</a> <a href="#clear" class="func_name">clear</a> <a href="#disenstacken" class="func_name">disenstacken</a> <a href="#first" class="func_name">first</a> <a href="#gcd" class="func_name">gcd</a> <a href="#popd" class="func_name">popd</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popop" class="func_name">popop</a> <a href="#popopop" class="func_name">popopop</a> <a href="#size" class="func_name">size</a> <a href="#small" class="func_name">small</a> <a href="#b75cae41e7f9ba4ab72cc1c5ec83aa5313ea180fae61bc25370ce4e4b540c3c7" class="func_name">spiral_next</a> <a href="#take" class="func_name">take</a> <a href="#unstack" class="func_name">unstack</a> <a href="#zip" class="func_name">zip</a></div></div><hr><div><h2 id="popd" class="func_name">popd <a href="#popd" class="self_link">¶</a></h2><p></p><div class="notes"><p>[pop] the second item down on the stack.</p>
 <pre><code>   a b popd
 --------------
       b
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#pop">pop</a>] <a href="#dip">dip</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#pop" class="func_name">pop</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popop" class="func_name">popop</a> <a href="#popopd" class="func_name">popopd</a> <a href="#popopdd" class="func_name">popopdd</a> <a href="#popopop" class="func_name">popopop</a></div><div class="backlinks"><h3>Used By</h3><a href="#binary" class="func_name">binary</a> <a href="#grba" class="func_name">grba</a> <a href="#rest" class="func_name">rest</a> <a href="#ternary" class="func_name">ternary</a> <a href="#unary" class="func_name">unary</a></div></div><hr><div><h2 id="popdd" class="func_name">popdd <a href="#popdd" class="self_link">¶</a></h2><p></p><div class="notes"><p>[pop] the third item on the stack.</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#pop">pop</a>] <a href="#dip">dip</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#pop" class="func_name">pop</a> <a href="#popdd" class="func_name">popdd</a> <a href="#popop" class="func_name">popop</a> <a href="#popopd" class="func_name">popopd</a> <a href="#popopdd" class="func_name">popopdd</a> <a href="#popopop" class="func_name">popopop</a></div><div class="backlinks"><h3>Used By</h3><a href="#binary" class="func_name">binary</a> <a href="#choice" class="func_name">choice</a> <a href="#grba" class="func_name">grba</a> <a href="#rest" class="func_name">rest</a> <a href="#ternary" class="func_name">ternary</a> <a href="#unary" class="func_name">unary</a></div></div><hr><div><h2 id="popdd" class="func_name">popdd <a href="#popdd" class="self_link">¶</a></h2><p></p><div class="notes"><p>[pop] the third item on the stack.</p>
 <pre><code>   a b c popdd
 -----------------
        b c
@@ -632,7 +632,7 @@ power.  (<code>n</code> is on the top of the stack.)</p>
 <pre><code>   2 [2 3 4 5 6 7 8 9] [pow] map
 -----------------------------------
     2 [4 8 16 32 64 128 256 512]
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">1 <a href="#93e14595116819706f1c5b8b64589abc8f3c47cfa09082a3fcb9156b5318d44a">roll&gt;</a> <a href="#swap">swap</a> [<a href="#684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1">*</a>] <a href="#cons">cons</a> <a href="#times">times</a></div></div></div><hr><div><h2 id="pred" class="func_name">pred <a href="#pred" class="self_link">¶</a></h2><p></p><div class="notes"><p>Predecessor. Decrement TOS.</p></div><div class="crosslinks"><h3>See Also</h3><a href="#succ" class="func_name">succ</a></div></div><hr><div><h2 id="primrec" class="func_name">primrec <a href="#primrec" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>From the <a href="https://www.kevinalbrecht.com/code/joy-mirror/j00ovr.html">"Overview of the language JOY"</a></p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">1 <a href="#93e14595116819706f1c5b8b64589abc8f3c47cfa09082a3fcb9156b5318d44a">roll&gt;</a> <a href="#swap">swap</a> [<a href="#684888c0ebb17f374298b65ee2807526c066094c701bcc7ebbe1c1095f494fc1">*</a>] <a href="#cons">cons</a> <a href="#times">times</a></div></div></div><hr><div><h2 id="pred" class="func_name">pred <a href="#pred" class="self_link">¶</a></h2><p></p><div class="notes"><p>Predecessor. Decrement TOS.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c">--</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#succ" class="func_name">succ</a></div></div><hr><div><h2 id="primrec" class="func_name">primrec <a href="#primrec" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>From the <a href="https://www.kevinalbrecht.com/code/joy-mirror/j00ovr.html">"Overview of the language JOY"</a></p>
 <blockquote>
 <p>The primrec combinator expects two quoted programs in addition to a
 data parameter. For an integer data parameter it works like this: If
@@ -701,7 +701,7 @@ or the item isn't in the list then the list is unchanged.</p>
 <p>See the <a href="https://osdn.net/projects/joypy/scm/git/Thun/blobs/master/docs/notebooks/Remove-Function.ipynb">"Remove Function" notebook</a>.</p></div></div><hr><div><h2 id="rest" class="func_name">rest <a href="#rest" class="self_link">¶</a></h2><p><span class="kind">built-in</span></p><div class="notes"><pre><code>   [a ...] rest
 ------------------
       [...]
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#uncons">uncons</a> <a href="#popd">popd</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#first" class="func_name">first</a> <a href="#uncons" class="func_name">uncons</a></div><div class="backlinks"><h3>Used By</h3><a href="#drop" class="func_name">drop</a> <a href="#fourth" class="func_name">fourth</a> <a href="#reco" class="func_name">reco</a> <a href="#rrest" class="func_name">rrest</a> <a href="#second" class="func_name">second</a> <a href="#small" class="func_name">small</a> <a href="#third" class="func_name">third</a> <a href="#uncons" class="func_name">uncons</a></div></div><hr><div><h2 id="reverse" class="func_name">reverse <a href="#reverse" class="self_link">¶</a></h2><p></p><div class="notes"><p>Reverse the list on the top of the stack.</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#uncons">uncons</a> <a href="#popd">popd</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#first" class="func_name">first</a> <a href="#uncons" class="func_name">uncons</a></div><div class="backlinks"><h3>Used By</h3><a href="#drop" class="func_name">drop</a> <a href="#fourth" class="func_name">fourth</a> <a href="#getitem" class="func_name">getitem</a> <a href="#reco" class="func_name">reco</a> <a href="#rrest" class="func_name">rrest</a> <a href="#second" class="func_name">second</a> <a href="#small" class="func_name">small</a> <a href="#third" class="func_name">third</a> <a href="#uncons" class="func_name">uncons</a></div></div><hr><div><h2 id="reverse" class="func_name">reverse <a href="#reverse" class="self_link">¶</a></h2><p></p><div class="notes"><p>Reverse the list on the top of the stack.</p>
 <h3>Example</h3>
 <pre><code>   [1 2 3] reverse
 ---------------------
@@ -821,7 +821,7 @@ complement to the "destructive" pair [enstacken] and [disenstacken].</p></div></
 <pre><code>   a b sub
 -------------
     (a-b)
-</code></pre></div><div class="crosslinks"><h3>See Also</h3><a href="#add" class="func_name">add</a></div></div><hr><div><h2 id="succ" class="func_name">succ <a href="#succ" class="self_link">¶</a></h2><p></p><div class="notes"><p>Successor. Increment TOS.</p></div><div class="crosslinks"><h3>See Also</h3><a href="#pred" class="func_name">pred</a></div></div><hr><div><h2 id="sum" class="func_name">sum <a href="#sum" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Given a quoted sequence of numbers return the sum.</p>
+</code></pre></div><div class="crosslinks"><h3>See Also</h3><a href="#add" class="func_name">add</a></div></div><hr><div><h2 id="succ" class="func_name">succ <a href="#succ" class="self_link">¶</a></h2><p></p><div class="notes"><p>Successor. Increment TOS.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#d8156bae0c4243d3742fc4e9774d8aceabe0410249d720c855f98afc88ff846c">--</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#pred" class="func_name">pred</a></div></div><hr><div><h2 id="sum" class="func_name">sum <a href="#sum" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Given a quoted sequence of numbers return the sum.</p>
 <h3>Example</h3>
 <pre><code>   [1 2 3 4 5] sum
 ---------------------
@@ -841,7 +841,7 @@ definition of [infra].</p></div></div><div class="crosslinks"><h3>See Also</h3><
 <pre><code>   a b c swapd
 -----------------
       b a c
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#swap">swap</a>] <a href="#dip">dip</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#over" class="func_name">over</a> <a href="#tuck" class="func_name">tuck</a></div><div class="backlinks"><h3>Used By</h3><a href="#2a40b97c2fcb8f8cea992e519101735a642ca89734b9b57ecca5e4586327a4bd" class="func_name">roll&lt;</a> <a href="#93e14595116819706f1c5b8b64589abc8f3c47cfa09082a3fcb9156b5318d44a" class="func_name">roll&gt;</a> <a href="#tuck" class="func_name">tuck</a></div></div><hr><div><h2 id="swoncat" class="func_name">swoncat <a href="#swoncat" class="self_link">¶</a></h2><p></p><div class="notes"><p>[concat] two lists, but [swap] the lists first.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#swap">swap</a> <a href="#concat">concat</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#concat" class="func_name">concat</a></div><div class="backlinks"><h3>Used By</h3><a href="#unstack" class="func_name">unstack</a></div></div><hr><div><h2 id="swons" class="func_name">swons <a href="#swons" class="self_link">¶</a></h2><p></p><div class="notes"><p>Like [cons] but [swap] the item and list.</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#swap">swap</a>] <a href="#dip">dip</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#over" class="func_name">over</a> <a href="#tuck" class="func_name">tuck</a></div><div class="backlinks"><h3>Used By</h3><a href="#2a40b97c2fcb8f8cea992e519101735a642ca89734b9b57ecca5e4586327a4bd" class="func_name">roll&lt;</a> <a href="#93e14595116819706f1c5b8b64589abc8f3c47cfa09082a3fcb9156b5318d44a" class="func_name">roll&gt;</a> <a href="#tuck" class="func_name">tuck</a> <a href="#" class="func_name">uncons-two</a></div></div><hr><div><h2 id="swoncat" class="func_name">swoncat <a href="#swoncat" class="self_link">¶</a></h2><p></p><div class="notes"><p>[concat] two lists, but [swap] the lists first.</p></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition"><a href="#swap">swap</a> <a href="#concat">concat</a></div></div><div class="crosslinks"><h3>See Also</h3><a href="#concat" class="func_name">concat</a></div><div class="backlinks"><h3>Used By</h3><a href="#unstack" class="func_name">unstack</a></div></div><hr><div><h2 id="swons" class="func_name">swons <a href="#swons" class="self_link">¶</a></h2><p></p><div class="notes"><p>Like [cons] but [swap] the item and list.</p>
 <pre><code>   [...] a swons
 -------------------
       [a ...]
@@ -890,7 +890,7 @@ program <code>n</code> times.</p>
 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.</div><div class="backlinks"><h3>Used By</h3><a href="#drop" class="func_name">drop</a> <a href="#grabN" class="func_name">grabN</a> <a href="#lshift" class="func_name">lshift</a> <a href="#pow" class="func_name">pow</a> <a href="#rshift" class="func_name">rshift</a> <a href="#take" class="func_name">take</a></div></div><hr><div><h2 id="tuck" class="func_name">tuck <a href="#tuck" class="self_link">¶</a></h2><p></p><div class="notes"><p>[dup] the item on the top of the stack under the second item on the
+in Lisp, or preprocessor directives in C.</div><div class="backlinks"><h3>Used By</h3><a href="#drop" class="func_name">drop</a> <a href="#getitem" class="func_name">getitem</a> <a href="#grabN" class="func_name">grabN</a> <a href="#lshift" class="func_name">lshift</a> <a href="#pow" class="func_name">pow</a> <a href="#rshift" class="func_name">rshift</a> <a href="#take" class="func_name">take</a></div></div><hr><div><h2 id="tuck" class="func_name">tuck <a href="#tuck" class="self_link">¶</a></h2><p></p><div class="notes"><p>[dup] the item on the top of the stack under the second item on the
 stack.</p>
 <pre><code>   a b tuck
 --------------
@@ -907,10 +907,10 @@ the list.  You cannot <code>uncons</code> an item from an empty list.</p>
 <pre><code>   [a ...] uncons
 --------------------
       a [...]
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#first">first</a>] <a href="#dupdip">dupdip</a> <a href="#rest">rest</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>This is the inverse of [cons].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#cons" class="func_name">cons</a></div><div class="backlinks"><h3>Used By</h3><a href="#first" class="func_name">first</a> <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two</a> <a href="#rest" class="func_name">rest</a> <a href="#shift" class="func_name">shift</a> <a href="#stuncons" class="func_name">stuncons</a> <a href="#unswons" class="func_name">unswons</a></div></div><hr><div><h2 id="unique" class="func_name">unique <a href="#unique" class="self_link">¶</a></h2><p></p><div class="notes"><p>Given a list remove duplicate items.</p></div></div><hr><div><h2 id="unit" class="func_name">unit <a href="#unit" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   a unit
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#first">first</a>] <a href="#dupdip">dupdip</a> <a href="#rest">rest</a></div></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>This is the inverse of [cons].</p></div></div><div class="crosslinks"><h3>See Also</h3><a href="#cons" class="func_name">cons</a></div><div class="backlinks"><h3>Used By</h3><a href="#first" class="func_name">first</a> <a href="#07b63cfff44ede6136263bf5857f5174d6e3657dfa7a1d9bb018089ee03d7236" class="func_name">first_two</a> <a href="#rest" class="func_name">rest</a> <a href="#shift" class="func_name">shift</a> <a href="#stuncons" class="func_name">stuncons</a> <a href="#" class="func_name">uncons-two</a> <a href="#unswons" class="func_name">unswons</a></div></div><hr><div><h2 id="unique" class="func_name">unique <a href="#unique" class="self_link">¶</a></h2><p></p><div class="notes"><p>Given a list remove duplicate items.</p></div></div><hr><div><h2 id="unit" class="func_name">unit <a href="#unit" class="self_link">¶</a></h2><p></p><div class="notes"><pre><code>   a unit
 ------------
     [a]
-</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[] <a href="#cons">cons</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#quoted" class="func_name">quoted</a> <a href="#ee391b3e0636502027aa14f8e4fd6498ee690f4cff6ebc247120e4cbb583a774" class="func_name">range_to_zero</a></div></div><hr><div><h2 id="unquoted" class="func_name">unquoted <a href="#unquoted" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Unquote (using [i]) the list that is second on the stack.</p>
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[] <a href="#cons">cons</a></div></div><div class="backlinks"><h3>Used By</h3><a href="#" class="func_name">quote-two</a> <a href="#quoted" class="func_name">quoted</a> <a href="#ee391b3e0636502027aa14f8e4fd6498ee690f4cff6ebc247120e4cbb583a774" class="func_name">range_to_zero</a></div></div><hr><div><h2 id="unquoted" class="func_name">unquoted <a href="#unquoted" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Unquote (using [i]) the list that is second on the stack.</p>
 <h3>Example</h3>
 <pre><code>   1 2 [3 4] 5 unquoted
 --------------------------
@@ -949,8 +949,8 @@ from each list. The smallest list sets the length of the result list.</p>
 <h3>Example</h3>
 <pre><code>   [1 2 3] [4 5 6] zip
 -------------------------
-   [[4 1] [5 2] [6 3]]
-</code></pre></div></div><hr><div><h2 id="565d240f5343e625ae579a4d45a770f1f02c6368b5ed4d06da4fbe6f47c28866" class="func_name">|| <a href="#565d240f5343e625ae579a4d45a770f1f02c6368b5ed4d06da4fbe6f47c28866" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Short-circuiting Boolean OR</p></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Accept two quoted programs, run the first and expect a Boolean value, if
+   [[1 4] [2 5] [3 6]]
+</code></pre></div><div class="definition_wrapper"><h3>Definition</h3><div class="definition">[<a href="#null">null</a>] [<a href="#pop">pop</a>] [<a href="#">uncons-pair</a>] [<a href="#i">i</a> <a href="#cons">cons</a>] <a href="#genrec">genrec</a></div></div></div><hr><div><h2 id="565d240f5343e625ae579a4d45a770f1f02c6368b5ed4d06da4fbe6f47c28866" class="func_name">|| <a href="#565d240f5343e625ae579a4d45a770f1f02c6368b5ed4d06da4fbe6f47c28866" class="self_link">¶</a></h2><p><span class="kind">combinator</span> </p><div class="notes"><p>Short-circuiting Boolean OR</p></div><div class="discussion_wrapper"><h3>Discussion</h3><div class="discussion"><p>Accept two quoted programs, run the first and expect a Boolean value, if
 it’s <code>false</code> pop it and run the second program (which should also return a
 Boolean value) otherwise pop the second program (leaving <code>true</code> on the
 stack.)
diff --git a/docs/html/notebooks/DeriveZip.html b/docs/html/notebooks/DeriveZip.html
new file mode 100644 (file)
index 0000000..eb7ba02
--- /dev/null
@@ -0,0 +1,56 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Zip</title>
+<link rel="stylesheet" href="/css/font/fonts.css">
+<link rel="stylesheet" href="/css/site.css">
+<script src="/Joy.js"></script>
+</head>
+<body>
+<div id="joy_interpreter"></div>
+<h1>Zip</h1>
+<p>Let's derive <code>zip</code>.</p>
+<pre><code>   [a b c ...] [e f g ...] zip
+---------------------------------
+     [[a e] [b f] [c g] ...]
+</code></pre>
+<p>It's a <code>genrec</code>:</p>
+<pre><code>zip == [null] [popop []] [R0] [R1] genrec
+</code></pre>
+<p>If the top list is empty, pop both lists and put a new empty list...</p>
+<p>Hmm...</p>
+<pre><code>zip == [null] [pop] [R0] [R1] genrec
+</code></pre>
+<p>We will assume that both lists are the same size, so if the top list is empty the second list shall be too, and we can reuse it to store our pairs.</p>
+<p>Now then, we have two non-empty lists:</p>
+<pre><code>[a b c ...] [e f g ...] R0 [zip] R1
+</code></pre>
+<p>Let's imagine a function <code>shift-pair</code>:</p>
+<pre><code>   [a ...] [e ...] shift-pair
+--------------------------------
+       [a e] [...] [...]
+</code></pre>
+<p>I'm going to defer derivation of that for now.</p>
+<pre><code>[a b c ...] [e f g ...] shift-pair [zip] R1
+
+[a e] [b c ...] [f g ...] [zip] R1
+</code></pre>
+<p>And so <code>R1</code> is <code>i cons</code> (it's a list builder.)</p>
+<pre><code>zip == [null] [pop] [shift-pair] [i cons] genrec
+</code></pre>
+<p>And now:</p>
+<pre><code>shift-pair == uncons-two [quote-two] dipd
+</code></pre>
+<p>w/</p>
+<pre><code>uncons-two == [uncons] ii swapd
+quote-two == unit cons
+
+[zip [null] [pop] [shift-pair] [i cons] genrec] inscribe
+[shift-pair uncons-two [quote-two] dipd] inscribe
+[uncons-two [uncons] ii swapd] inscribe
+[quote-two unit cons] inscribe
+</code></pre>
+<script>var joy_interpreter = Elm.Main.init({node: document.getElementById('joy_interpreter')});</script>
+</body>
+</html>
index b5a3714..2d4da7f 100644 (file)
@@ -3362,5 +3362,5 @@ 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]]
+       [[1 4] [2 5] [3 6]]
 
diff --git a/docs/source/notebooks/DeriveZip.md b/docs/source/notebooks/DeriveZip.md
new file mode 100644 (file)
index 0000000..b8fbe57
--- /dev/null
@@ -0,0 +1,54 @@
+# Zip
+
+Let's derive `zip`.
+
+       [a b c ...] [e f g ...] zip
+    ---------------------------------
+         [[a e] [b f] [c g] ...]
+
+It's a `genrec`:
+
+    zip == [null] [popop []] [R0] [R1] genrec
+
+If the top list is empty, pop both lists and put a new empty list...
+
+Hmm...
+
+    zip == [null] [pop] [R0] [R1] genrec
+
+We will assume that both lists are the same size, so if the top list is empty the second list shall be too, and we can reuse it to store our pairs.
+
+Now then, we have two non-empty lists:
+
+    [a b c ...] [e f g ...] R0 [zip] R1
+
+Let's imagine a function `shift-pair`:
+
+       [a ...] [e ...] shift-pair
+    --------------------------------
+           [a e] [...] [...]
+
+I'm going to defer derivation of that for now.
+
+    [a b c ...] [e f g ...] shift-pair [zip] R1
+
+    [a e] [b c ...] [f g ...] [zip] R1
+
+And so `R1` is `i cons` (it's a list builder.)
+
+    zip == [null] [pop] [shift-pair] [i cons] genrec
+
+And now:
+
+    shift-pair == uncons-two [quote-two] dipd
+
+w/
+
+    uncons-two == [uncons] ii swapd
+    quote-two == unit cons
+
+    [zip [null] [pop] [shift-pair] [i cons] genrec] inscribe
+    [shift-pair uncons-two [quote-two] dipd] inscribe
+    [uncons-two [uncons] ii swapd] inscribe
+    [quote-two unit cons] inscribe
+
index 0c8816b..eb9c923 100644 (file)
@@ -1 +1 @@
-(define (defs) (list "eq [false] [true] [false] cmp" "gt [true] [false] [false] cmp" "lt [false] [false] [true] cmp" "neq [true] [false] [true] cmp" "le [false] [true] [true] cmp" "ge [true] [true] [false] cmp" "? dup bool" "!- 0 >=" "++ 1 +" "-- 1 -" "<{} [] swap" "<<{} [] rollup" "abs dup 0 < [] [neg] branch" "anamorphism [pop []] swap [dip swons] genrec" "and nulco [nullary [false]] dip branch" "app1 grba infrst" "app2 [grba swap grba swap] dip [infrst] cons ii" "app3 3 appN" "appN [grabN] codi map reverse disenstacken" "at drop first" "average [sum] [size] cleave /" "b [i] dip i" "binary unary popd" "ccccons ccons ccons" "ccons cons cons" "clear [] swaack pop" "cleave fork popdd" "clop cleave popdd" "cmp [[>] swap] dipd [ifte] ccons [=] swons ifte" "codi cons dip" "codireco codi reco" "dinfrirst dip infrst" "dipd [dip] codi" "dipdd [dip] cons dipd" "dipddd [dipd] cons dipd" "disenstacken swaack pop" "divmod [/] [%] clop" "down_to_zero [0 >] [dup --] while" "drop [rest] times" "dupdd [dup] dipd" "dupd [dup] dip" "dupdipd dup dipd" "dupdip dupd dip" "enstacken stack [clear] dip" "first uncons pop" "flatten <{} [concat] step" "fork [i] app2" "fourth rest third" "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" "infrst infra first" "<< lshift" "lshift [2 *] times" "make_generator [codireco] ccons" "mod %" "neg 0 swap -" "not [true] [false] branch" "nulco [nullary] cons" "nullary [stack] dinfrirst" "null [] swap concat bool not" "of swap at" "or nulco [nullary] dip [true] branch" "over [dup] dip swap" "pam [i] map" "pm [+] [-] clop" "popdd [pop] dipd" "popd [pop] dip" "popopdd [popop] dipd" "popopd [popop] dip" "popopop pop popop" "popop pop pop" "pow 1 roll> swap [*] cons times" "product 1 swap [*] step" "quoted [unit] dip" "range [0 <=] [-- dup] anamorphism" "range_to_zero unit [down_to_zero] infra" "reco rest cons" "rest uncons popd" "reverse <{} shunt" "rolldown roll<" "roll< swapd swap" "roll> swap swapd" "rollup roll>" "rrest rest rest" ">> rshift" "rshift [2 /] times" "run <{} infra" "second rest first" "shift uncons [swons] dip" "shunt [swons] step" "size [pop ++] step_zero" "small dup null [rest null] [pop true] branch" "spiral_next [[[abs] ii <=] [[<>] [pop !-] or] and] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte" "split_at [drop] [take] clop" "split_list [take reverse] [drop] clop" "sqr dup mul" "stackd [stack] dip" "step_zero 0 roll> step" "stuncons stack uncons" "sum [+] step_zero" "swapd [swap] dip" "swoncat swap concat" "swons swap cons" "tailrec [i] genrec" "take <<{} [shift] times pop" "ternary binary popd" "third rest second" "tuck dup swapd" "unary nullary popd" "uncons [first] dupdip rest" "unit [] cons" "unquoted [i] dip" "unstack [[] swaack] dip swoncat swaack pop" "unswons uncons swap" "while swap nulco dupdipd concat loop" "x dup i" "step [_step0] x" "_step0 _step1 [popopop] [_stept] branch" "_step1 [?] dipd roll<" "_stept [uncons] dipd [dupdipd] dip x" "times [_times0] x" "_times0 _times1 [popopop] [_timest] branch" "_times1 [dup 0 >] dipd roll<" "_timest [[--] dip dupdipd] dip x" "map [_map0] cons [[] [_map?] [_mape]] dip tailrec" "_map? pop bool not" "_mape popd reverse" "_map0 [_map1] dipd _map2" "_map1 stackd shift" "_map2 [infrst] cons dipd roll< swons" "_isnt_bool not not" "_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"))
\ No newline at end of file
+(define (defs) (list "eq [false] [true] [false] cmp" "gt [true] [false] [false] cmp" "lt [false] [false] [true] cmp" "neq [true] [false] [true] cmp" "le [false] [true] [true] cmp" "ge [true] [true] [false] cmp" "? dup bool" "!- 0 >=" "++ 1 +" "-- 1 -" "<{} [] swap" "<<{} [] rollup" "abs dup 0 < [] [neg] branch" "anamorphism [pop []] swap [dip swons] genrec" "and nulco [nullary [false]] dip branch" "app1 grba infrst" "app2 [grba swap grba swap] dip [infrst] cons ii" "app3 3 appN" "appN [grabN] codi map reverse disenstacken" "at drop first" "average [sum] [size] cleave /" "b [i] dip i" "binary unary popd" "ccccons ccons ccons" "ccons cons cons" "clear [] swaack pop" "cleave fork popdd" "clop cleave popdd" "cmp [[>] swap] dipd [ifte] ccons [=] swons ifte" "codi cons dip" "codireco codi reco" "dinfrirst dip infrst" "dipd [dip] codi" "dipdd [dip] cons dipd" "dipddd [dipd] cons dipd" "disenstacken swaack pop" "divmod [/] [%] clop" "down_to_zero [0 >] [dup --] while" "drop [rest] times" "dupdd [dup] dipd" "dupd [dup] dip" "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" "gcd true [tuck mod dup 0 >] loop pop" "genrec [[genrec] ccccons] nullary swons concat ifte" "grabN <{} [cons] times" "grba [stack popd] dip" "ifte [nullary] dipd swap branch" "ii [dip] dupdip i" "infra swons swaack [i] dip swaack" "infrst infra first" "<< lshift" "lshift [2 *] times" "make_generator [codireco] ccons" "mod %" "neg 0 swap -" "not [true] [false] branch" "nulco [nullary] cons" "nullary [stack] dinfrirst" "null _isnt_list bool not" "of swap at" "or nulco [nullary] dip [true] branch" "over [dup] dip swap" "pam [i] map" "pm [+] [-] clop" "popdd [pop] dipd" "popd [pop] dip" "popopdd [popop] dipd" "popopd [popop] dip" "popopop pop popop" "popop pop pop" "pow 1 roll> swap [*] cons times" "product 1 swap [*] step" "quoted [unit] dip" "range [0 <=] [-- dup] anamorphism" "range_to_zero unit [down_to_zero] infra" "reco rest cons" "rest uncons popd" "reverse <{} shunt" "rolldown roll<" "roll< swapd swap" "roll> swap swapd" "rollup roll>" "rrest rest rest" ">> rshift" "rshift [2 /] times" "run <{} infra" "second rest first" "shift uncons [swons] dip" "shunt [swons] step" "size [pop ++] step_zero" "small dup null [rest null] [pop true] branch" "spiral_next [[[abs] ii <=] [[<>] [pop !-] or] and] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte" "split_at [drop] [take] clop" "split_list [take reverse] [drop] clop" "sqr dup mul" "stackd [stack] dip" "step_zero 0 roll> step" "stuncons stack uncons" "sum [+] step_zero" "swapd [swap] dip" "swoncat swap concat" "swons swap cons" "tailrec [i] genrec" "take <<{} [shift] times pop" "ternary binary popd" "third rest second" "tuck dup swapd" "unary nullary popd" "uncons [first] dupdip rest" "unit [] cons" "unquoted [i] dip" "unstack [[] swaack] dip swoncat swaack pop" "unswons uncons swap" "while swap nulco dupdipd concat loop" "x dup i" "step [_step0] x" "_step0 _step1 [popopop] [_stept] branch" "_step1 [?] dipd roll<" "_stept [uncons] dipd [dupdipd] dip x" "times [_times0] x" "_times0 _times1 [popopop] [_timest] branch" "_times1 [dup 0 >] dipd roll<" "_timest [[--] dip dupdipd] dip x" "map [_map0] cons [[] [_map?] [_mape]] dip tailrec" "_map? pop bool not" "_mape popd reverse" "_map0 [_map1] dipd _map2" "_map1 stackd shift" "_map2 [infrst] cons dipd roll< swons" "_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" "_isnt_list [] swoncat" "zip [null] [pop] [shift-pair] [i cons] genrec" "shift-pair uncons-two [quote-two] dipd" "uncons-two [uncons] ii swapd" "quote-two unit cons"))
\ No newline at end of file