OSDN Git Service

A little more bit o' docs.
authorSimon Forman <sforman@hushmail.com>
Sat, 14 Jul 2018 19:29:25 +0000 (12:29 -0700)
committerSimon Forman <sforman@hushmail.com>
Sat, 14 Jul 2018 19:29:25 +0000 (12:29 -0700)
20 files changed:
docs/Derivatives_of_Regular_Expressions.ipynb
docs/Makefile
docs/sphinx_docs/_build/html/_modules/joy/library.html
docs/sphinx_docs/_build/html/genindex.html
docs/sphinx_docs/_build/html/index.html
docs/sphinx_docs/_build/html/library.html
docs/sphinx_docs/_build/html/notebooks/Generator_Programs.html
docs/sphinx_docs/_build/html/notebooks/Ordered_Binary_Trees.html
docs/sphinx_docs/_build/html/notebooks/Recursion_Combinators.html
docs/sphinx_docs/_build/html/notebooks/Replacing.html
docs/sphinx_docs/_build/html/notebooks/index.html
docs/sphinx_docs/_build/html/objects.inv
docs/sphinx_docs/_build/html/searchindex.js
docs/sphinx_docs/_build/html/types.html
docs/sphinx_docs/notebooks/Derivatives_of_Regular_Expressions.rst [new file with mode: 0644]
docs/sphinx_docs/notebooks/Generator_Programs.rst
docs/sphinx_docs/notebooks/Recursion_Combinators.rst
docs/sphinx_docs/notebooks/The_Four_Operations.rst [new file with mode: 0644]
docs/sphinx_docs/notebooks/TypeChecking.rst [new file with mode: 0644]
docs/sphinx_docs/notebooks/omg.svg [new file with mode: 0644]

index 928cc58..d42699c 100644 (file)
    "metadata": {},
    "outputs": [],
    "source": [
-    "# This is the straightforward version with no \"compaction\".\n",
-    "# It works fine, but does waaaay too much work because the\n",
-    "# expressions grow each derivation.\n",
-    "\n",
     "def D(symbol):\n",
     "\n",
     "    def derv(R):\n",
index 9c7b6eb..763cddc 100644 (file)
@@ -23,7 +23,7 @@ $(docs_rst): %.rst : %.ipynb
        python -m nbconvert --to rst $<
 
 
-move_us = Generator_Programs.rst Newton-Raphson.rst Ordered_Binary_Trees.rst Quadratic.rst Recursion_Combinators.rst Replacing.rst Treestep.rst Types.rst Zipper.rst
+move_us = Derivatives_of_Regular_Expressions.rst Generator_Programs.rst Newton-Raphson.rst Ordered_Binary_Trees.rst Quadratic.rst Recursion_Combinators.rst Replacing.rst The_Four_Operations.rst Treestep.rst TypeChecking.rst Types.rst Zipper.rst
 
 mov: $(move_us)
        cp -v $? ./sphinx_docs/notebooks/
index 1fee689..dc60009 100644 (file)
   <span class="p">(</span><span class="s1">&#39;pred&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;--&#39;</span><span class="p">]),</span>
   <span class="p">(</span><span class="s1">&#39;rolldown&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;roll&lt;&#39;</span><span class="p">]),</span>
   <span class="p">(</span><span class="s1">&#39;rollup&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;roll&gt;&#39;</span><span class="p">]),</span>
-  <span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;•&#39;</span><span class="p">]),</span>
+  <span class="p">(</span><span class="s1">&#39;id&#39;</span><span class="p">,</span> <span class="p">[</span><span class="sa">u</span><span class="s1">&#39;•&#39;</span><span class="p">]),</span>
   <span class="p">)</span>
 
 
 <span class="s1">run == [] swap infra</span>
 <span class="s1">sqr == dup mul</span>
 <span class="s1">size == 0 swap [pop ++] step</span>
-<span class="s1">cleave == [i] app2 [popd] dip</span>
+<span class="s1">fork == [i] app2</span>
+<span class="s1">cleave == fork [popd] dip</span>
 <span class="s1">average == [sum 1.0 *] [size] cleave /</span>
 <span class="s1">gcd == 1 [tuck modulus dup 0 &gt;] loop pop</span>
 <span class="s1">least_fraction == dup [gcd] infra [div] concat map</span>
 <span class="s1">step_zero == 0 roll&gt; step</span>
 <span class="s1">codireco == cons dip rest cons</span>
 <span class="s1">make_generator == [codireco] ccons</span>
+<span class="s1">ifte == [nullary not] dipd branch</span>
 <span class="s1">&#39;&#39;&#39;</span>
-<span class="c1"># ifte == [nullary not] dipd branch</span>
+<span class="c1"># </span>
 <span class="c1"># ifte == [nullary] dipd swap branch</span>
 <span class="c1"># genrec == [[genrec] cons cons cons cons] nullary swons concat ifte</span>
 
   <span class="sd">&#39;&#39;&#39;Clear everything from the stack.</span>
 <span class="sd">  ::</span>
 
+<span class="sd">    clear == stack [pop stack] loop</span>
+
 <span class="sd">       ... clear</span>
 <span class="sd">    ---------------</span>
 
   <span class="k">return</span> <span class="n">stack</span><span class="p">,</span> <span class="n">concat</span><span class="p">(</span><span class="n">then</span> <span class="k">if</span> <span class="n">flag</span> <span class="k">else</span> <span class="n">else_</span><span class="p">,</span> <span class="n">expression</span><span class="p">),</span> <span class="n">dictionary</span></div>
 
 
-<div class="viewcode-block" id="ifte"><a class="viewcode-back" href="../../library.html#joy.library.ifte">[docs]</a><span class="nd">@inscribe</span>
-<span class="nd">@FunctionWrapper</span>
-<span class="k">def</span> <span class="nf">ifte</span><span class="p">(</span><span class="n">stack</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dictionary</span><span class="p">):</span>
-  <span class="sd">&#39;&#39;&#39;</span>
-<span class="sd">  If-Then-Else Combinator</span>
-<span class="sd">  ::</span>
-
-<span class="sd">                  ... [if] [then] [else] ifte</span>
-<span class="sd">       ---------------------------------------------------</span>
-<span class="sd">          ... [[else] [then]] [...] [if] infra select i</span>
-
-
-
-
-<span class="sd">                ... [if] [then] [else] ifte</span>
-<span class="sd">       -------------------------------------------------------</span>
-<span class="sd">          ... [else] [then] [...] [if] infra first choice i</span>
-
-
-<span class="sd">  Has the effect of grabbing a copy of the stack on which to run the</span>
-<span class="sd">  if-part using infra.</span>
-<span class="sd">  &#39;&#39;&#39;</span>
-  <span class="p">(</span><span class="n">else_</span><span class="p">,</span> <span class="p">(</span><span class="n">then</span><span class="p">,</span> <span class="p">(</span><span class="n">if_</span><span class="p">,</span> <span class="n">stack</span><span class="p">)))</span> <span class="o">=</span> <span class="n">stack</span>
-  <span class="n">expression</span> <span class="o">=</span> <span class="p">(</span><span class="n">S_infra</span><span class="p">,</span> <span class="p">(</span><span class="n">S_first</span><span class="p">,</span> <span class="p">(</span><span class="n">S_choice</span><span class="p">,</span> <span class="p">(</span><span class="n">S_i</span><span class="p">,</span> <span class="n">expression</span><span class="p">))))</span>
-  <span class="n">stack</span> <span class="o">=</span> <span class="p">(</span><span class="n">if_</span><span class="p">,</span> <span class="p">(</span><span class="n">stack</span><span class="p">,</span> <span class="p">(</span><span class="n">then</span><span class="p">,</span> <span class="p">(</span><span class="n">else_</span><span class="p">,</span> <span class="n">stack</span><span class="p">))))</span>
-  <span class="k">return</span> <span class="n">stack</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dictionary</span></div>
+<span class="c1">##@inscribe</span>
+<span class="c1">##@FunctionWrapper</span>
+<span class="c1">##def ifte(stack, expression, dictionary):</span>
+<span class="c1">##  &#39;&#39;&#39;</span>
+<span class="c1">##  If-Then-Else Combinator</span>
+<span class="c1">##  ::</span>
+<span class="c1">##</span>
+<span class="c1">##                  ... [if] [then] [else] ifte</span>
+<span class="c1">##       ---------------------------------------------------</span>
+<span class="c1">##          ... [[else] [then]] [...] [if] infra select i</span>
+<span class="c1">##</span>
+<span class="c1">##</span>
+<span class="c1">##</span>
+<span class="c1">##</span>
+<span class="c1">##                ... [if] [then] [else] ifte</span>
+<span class="c1">##       -------------------------------------------------------</span>
+<span class="c1">##          ... [else] [then] [...] [if] infra first choice i</span>
+<span class="c1">##</span>
+<span class="c1">##</span>
+<span class="c1">##  Has the effect of grabbing a copy of the stack on which to run the</span>
+<span class="c1">##  if-part using infra.</span>
+<span class="c1">##  &#39;&#39;&#39;</span>
+<span class="c1">##  (else_, (then, (if_, stack))) = stack</span>
+<span class="c1">##  expression = (S_infra, (S_first, (S_choice, (S_i, expression))))</span>
+<span class="c1">##  stack = (if_, (stack, (then, (else_, stack))))</span>
+<span class="c1">##  return stack, expression, dictionary</span>
 
 
 <div class="viewcode-block" id="cond"><a class="viewcode-back" href="../../library.html#joy.library.cond">[docs]</a><span class="nd">@inscribe</span>
index 288ec01..09d787a 100644 (file)
       </ul></li>
       <li><a href="library.html#joy.library.add_aliases">add_aliases() (in module joy.library)</a>
 </li>
-      <li><a href="library.html#joy.library.DefinitionWrapper.add_def">add_def() (joy.library.DefinitionWrapper class method)</a>
-</li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="library.html#joy.library.DefinitionWrapper.add_def">add_def() (joy.library.DefinitionWrapper class method)</a>
+</li>
       <li><a href="library.html#joy.library.DefinitionWrapper.add_definitions">add_definitions() (joy.library.DefinitionWrapper class method)</a>
 </li>
       <li><a href="types.html#joy.utils.types.AnyJoyType">AnyJoyType (class in joy.utils.types)</a>
 </li>
-      <li><a href="types.html#joy.utils.polytypes.AnyStarJoyType">AnyStarJoyType (class in joy.utils.polytypes)</a>
-</li>
       <li><a href="library.html#joy.library.app1">app1() (in module joy.library)</a>
 </li>
       <li><a href="library.html#joy.library.app2">app2() (in module joy.library)</a>
 </li>
       <li><a href="library.html#joy.library.id_">id_() (in module joy.library)</a>
 </li>
-      <li><a href="library.html#joy.library.ifte">ifte() (in module joy.library)</a>
-</li>
       <li><a href="types.html#joy.utils.polytypes.infer">infer() (in module joy.utils.polytypes)</a>
 </li>
       <li><a href="library.html#joy.library.infra">infra() (in module joy.library)</a>
 <h2 id="K">K</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="types.html#joy.utils.polytypes.AnyStarJoyType.kind">kind (joy.utils.polytypes.AnyStarJoyType attribute)</a>
-
-      <ul>
-        <li><a href="types.html#joy.utils.polytypes.KleeneStar.kind">(joy.utils.polytypes.KleeneStar attribute)</a>
+      <li><a href="types.html#joy.utils.polytypes.KleeneStar.kind">kind (joy.utils.polytypes.KleeneStar attribute)</a>
 </li>
-        <li><a href="types.html#joy.utils.polytypes.NumberStarJoyType.kind">(joy.utils.polytypes.NumberStarJoyType attribute)</a>
-</li>
-        <li><a href="types.html#joy.utils.polytypes.StackStarJoyType.kind">(joy.utils.polytypes.StackStarJoyType attribute)</a>
-</li>
-      </ul></li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="types.html#joy.utils.polytypes.KleeneStar">KleeneStar (class in joy.utils.polytypes)</a>
       <li><a href="types.html#joy.utils.types.NumberJoyType">NumberJoyType (class in joy.utils.types)</a>
 </li>
   </ul></td>
-  <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="types.html#joy.utils.polytypes.NumberStarJoyType">NumberStarJoyType (class in joy.utils.polytypes)</a>
-</li>
-  </ul></td>
 </tr></table>
 
 <h2 id="O">O</h2>
 </li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="types.html#joy.utils.polytypes.StackStarJoyType">StackStarJoyType (class in joy.utils.polytypes)</a>
-</li>
       <li><a href="library.html#joy.library.step">step() (in module joy.library)</a>
 </li>
       <li><a href="library.html#joy.utils.generated_library.stuncons">stuncons() (in module joy.utils.generated_library)</a>
index 65c6c76..4172f40 100644 (file)
@@ -140,7 +140,7 @@ interesting aspects.  It’s quite a treasure trove.</p>
 <li class="toctree-l2"><a class="reference internal" href="notebooks/Developing.html">Developing a Program in Joy</a></li>
 <li class="toctree-l2"><a class="reference internal" href="notebooks/Quadratic.html">Quadratic formula</a></li>
 <li class="toctree-l2"><a class="reference internal" href="notebooks/Replacing.html">Replacing Functions in the Dictionary</a></li>
-<li class="toctree-l2"><a class="reference internal" href="notebooks/Recursion_Combinators.html">Recursive Combinators</a></li>
+<li class="toctree-l2"><a class="reference internal" href="notebooks/Recursion_Combinators.html">Recursion Combinators</a></li>
 <li class="toctree-l2"><a class="reference internal" href="notebooks/Ordered_Binary_Trees.html">Treating Trees I: Ordered Binary Trees</a></li>
 <li class="toctree-l2"><a class="reference internal" href="notebooks/Treestep.html">Treating Trees II: <code class="docutils literal notranslate"><span class="pre">treestep</span></code></a></li>
 <li class="toctree-l2"><a class="reference internal" href="notebooks/Generator_Programs.html">Using <code class="docutils literal notranslate"><span class="pre">x</span></code> to Generate Values</a></li>
index bf08515..2571a27 100644 (file)
@@ -187,7 +187,9 @@ Boolean value (so empty string, zero, etc. are counted as false, etc.)</p>
 <dt id="joy.library.clear">
 <code class="descclassname">joy.library.</code><code class="descname">clear</code><span class="sig-paren">(</span><em>stack</em>, <em>expression</em>, <em>dictionary</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/library.html#clear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.library.clear" title="Permalink to this definition">¶</a></dt>
 <dd><p>Clear everything from the stack.</p>
-<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>   <span class="o">...</span> <span class="n">clear</span>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">clear</span> <span class="o">==</span> <span class="n">stack</span> <span class="p">[</span><span class="n">pop</span> <span class="n">stack</span><span class="p">]</span> <span class="n">loop</span>
+
+   <span class="o">...</span> <span class="n">clear</span>
 <span class="o">---------------</span>
 </pre></div>
 </div>
@@ -404,26 +406,6 @@ onto the pending expression for evaluation.</p>
 </dd></dl>
 
 <dl class="function">
-<dt id="joy.library.ifte">
-<code class="descclassname">joy.library.</code><code class="descname">ifte</code><span class="sig-paren">(</span><em>stack</em>, <em>expression</em>, <em>dictionary</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/library.html#ifte"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.library.ifte" title="Permalink to this definition">¶</a></dt>
-<dd><p>If-Then-Else Combinator</p>
-<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>           <span class="o">...</span> <span class="p">[</span><span class="k">if</span><span class="p">]</span> <span class="p">[</span><span class="n">then</span><span class="p">]</span> <span class="p">[</span><span class="k">else</span><span class="p">]</span> <span class="n">ifte</span>
-<span class="o">---------------------------------------------------</span>
-   <span class="o">...</span> <span class="p">[[</span><span class="k">else</span><span class="p">]</span> <span class="p">[</span><span class="n">then</span><span class="p">]]</span> <span class="p">[</span><span class="o">...</span><span class="p">]</span> <span class="p">[</span><span class="k">if</span><span class="p">]</span> <span class="n">infra</span> <span class="n">select</span> <span class="n">i</span>
-
-
-
-
-         <span class="o">...</span> <span class="p">[</span><span class="k">if</span><span class="p">]</span> <span class="p">[</span><span class="n">then</span><span class="p">]</span> <span class="p">[</span><span class="k">else</span><span class="p">]</span> <span class="n">ifte</span>
-<span class="o">-------------------------------------------------------</span>
-   <span class="o">...</span> <span class="p">[</span><span class="k">else</span><span class="p">]</span> <span class="p">[</span><span class="n">then</span><span class="p">]</span> <span class="p">[</span><span class="o">...</span><span class="p">]</span> <span class="p">[</span><span class="k">if</span><span class="p">]</span> <span class="n">infra</span> <span class="n">first</span> <span class="n">choice</span> <span class="n">i</span>
-</pre></div>
-</div>
-<p>Has the effect of grabbing a copy of the stack on which to run the
-if-part using infra.</p>
-</dd></dl>
-
-<dl class="function">
 <dt id="joy.library.infra">
 <code class="descclassname">joy.library.</code><code class="descname">infra</code><span class="sig-paren">(</span><em>stack</em>, <em>expression</em>, <em>dictionary</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/library.html#infra"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.library.infra" title="Permalink to this definition">¶</a></dt>
 <dd><p>Accept a quoted program and a list on the stack and run the program
index cb7830d..ac0e819 100644 (file)
@@ -366,10 +366,9 @@ numbers sixty-six times and then four more.</p>
 </div>
 <div class="section" id="project-euler-problem-two">
 <h2>Project Euler Problem Two<a class="headerlink" href="#project-euler-problem-two" title="Permalink to this headline">¶</a></h2>
-<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">By</span> <span class="n">considering</span> <span class="n">the</span> <span class="n">terms</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">Fibonacci</span> <span class="n">sequence</span> <span class="n">whose</span> <span class="n">values</span> <span class="n">do</span> <span class="ow">not</span> <span class="n">exceed</span> <span class="n">four</span> <span class="n">million</span><span class="p">,</span>
-<span class="n">find</span> <span class="n">the</span> <span class="nb">sum</span> <span class="n">of</span> <span class="n">the</span> <span class="n">even</span><span class="o">-</span><span class="n">valued</span> <span class="n">terms</span><span class="o">.</span>
-</pre></div>
-</div>
+<blockquote>
+<div>By considering the terms in the Fibonacci sequence whose values do
+not exceed four million, find the sum of the even-valued terms.</div></blockquote>
 <p>Now that we have a generator for the Fibonacci sequence, we need a
 function that adds a term in the sequence to a sum if it is even, and
 <code class="docutils literal notranslate"><span class="pre">pop</span></code>s it otherwise.</p>
index 054a8b4..229e23b 100644 (file)
@@ -17,7 +17,7 @@
     <link rel="index" title="Index" href="../genindex.html" />
     <link rel="search" title="Search" href="../search.html" />
     <link rel="next" title="Treating Trees II: treestep" href="Treestep.html" />
-    <link rel="prev" title="Recursive Combinators" href="Recursion_Combinators.html" />
+    <link rel="prev" title="Recursion Combinators" href="Recursion_Combinators.html" />
    
   <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
   
@@ -1373,7 +1373,7 @@ Tree-delete == [pop not] [pop] [_Tree_delete_R0] [_Tree_delete_R1] genrec
 <ul>
   <li><a href="../index.html">Documentation overview</a><ul>
   <li><a href="index.html">Essays about Programming in Joy</a><ul>
-      <li>Previous: <a href="Recursion_Combinators.html" title="previous chapter">Recursive Combinators</a></li>
+      <li>Previous: <a href="Recursion_Combinators.html" title="previous chapter">Recursion Combinators</a></li>
       <li>Next: <a href="Treestep.html" title="next chapter">Treating Trees II: <code class="docutils literal notranslate"><span class="pre">treestep</span></code></a></li>
   </ul></li>
   </ul></li>
index b00986e..362032f 100644 (file)
@@ -6,7 +6,7 @@
   <head>
     <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>Recursive Combinators &#8212; Thun 0.2.0 documentation</title>
+    <title>Recursion Combinators &#8212; Thun 0.2.0 documentation</title>
     <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
     <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
     <script type="text/javascript" src="../_static/documentation_options.js"></script>
@@ -35,8 +35,8 @@
   <div class="code ipython2 highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">notebook_preamble</span> <span class="k">import</span> <span class="n">D</span><span class="p">,</span> <span class="n">DefinitionWrapper</span><span class="p">,</span> <span class="n">J</span><span class="p">,</span> <span class="n">V</span><span class="p">,</span> <span class="n">define</span>
 </pre></div>
 </div>
-<div class="section" id="recursive-combinators">
-<h1>Recursive Combinators<a class="headerlink" href="#recursive-combinators" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="recursion-combinators">
+<h1>Recursion Combinators<a class="headerlink" href="#recursion-combinators" title="Permalink to this headline">¶</a></h1>
 <p>This article describes the <code class="docutils literal notranslate"><span class="pre">genrec</span></code> combinator, how to use it, and
 several generic specializations.</p>
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>                      <span class="p">[</span><span class="k">if</span><span class="p">]</span> <span class="p">[</span><span class="n">then</span><span class="p">]</span> <span class="p">[</span><span class="n">rec1</span><span class="p">]</span> <span class="p">[</span><span class="n">rec2</span><span class="p">]</span> <span class="n">genrec</span>
@@ -598,7 +598,7 @@ Wire”</a></p>
         <div class="sphinxsidebarwrapper">
   <h3><a href="../index.html">Table Of Contents</a></h3>
   <ul>
-<li><a class="reference internal" href="#">Recursive Combinators</a><ul>
+<li><a class="reference internal" href="#">Recursion Combinators</a><ul>
 <li><a class="reference internal" href="#designing-recursive-functions">Designing Recursive Functions</a></li>
 <li><a class="reference internal" href="#primitive-recursive-functions">Primitive Recursive Functions</a></li>
 <li><a class="reference internal" href="#hylomorphism">Hylomorphism</a></li>
index d1345dd..088f4a6 100644 (file)
@@ -16,7 +16,7 @@
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
     <link rel="index" title="Index" href="../genindex.html" />
     <link rel="search" title="Search" href="../search.html" />
-    <link rel="next" title="Recursive Combinators" href="Recursion_Combinators.html" />
+    <link rel="next" title="Recursion Combinators" href="Recursion_Combinators.html" />
     <link rel="prev" title="Quadratic formula" href="Quadratic.html" />
    
   <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
@@ -185,7 +185,7 @@ and re-evaluate the expression.</p>
   <li><a href="../index.html">Documentation overview</a><ul>
   <li><a href="index.html">Essays about Programming in Joy</a><ul>
       <li>Previous: <a href="Quadratic.html" title="previous chapter">Quadratic formula</a></li>
-      <li>Next: <a href="Recursion_Combinators.html" title="next chapter">Recursive Combinators</a></li>
+      <li>Next: <a href="Recursion_Combinators.html" title="next chapter">Recursion Combinators</a></li>
   </ul></li>
   </ul></li>
 </ul>
index 63e09f4..8aae107 100644 (file)
@@ -55,7 +55,7 @@
 <li class="toctree-l2"><a class="reference internal" href="Replacing.html#a-shorter-trace">A shorter trace</a></li>
 </ul>
 </li>
-<li class="toctree-l1"><a class="reference internal" href="Recursion_Combinators.html">Recursive Combinators</a><ul>
+<li class="toctree-l1"><a class="reference internal" href="Recursion_Combinators.html">Recursion Combinators</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="Recursion_Combinators.html#designing-recursive-functions">Designing Recursive Functions</a></li>
 <li class="toctree-l2"><a class="reference internal" href="Recursion_Combinators.html#primitive-recursive-functions">Primitive Recursive Functions</a></li>
 <li class="toctree-l2"><a class="reference internal" href="Recursion_Combinators.html#hylomorphism">Hylomorphism</a></li>
index 2de5649..c2e91b5 100644 (file)
Binary files a/docs/sphinx_docs/_build/html/objects.inv and b/docs/sphinx_docs/_build/html/objects.inv differ
index 38d408d..943138a 100644 (file)
@@ -1 +1 @@
-Search.setIndex({docnames:["index","joy","lib","library","notebooks/Categorical","notebooks/Developing","notebooks/Generator_Programs","notebooks/Intro","notebooks/Newton-Raphson","notebooks/NoUpdates","notebooks/Ordered_Binary_Trees","notebooks/Quadratic","notebooks/Recursion_Combinators","notebooks/Replacing","notebooks/Treestep","notebooks/Types","notebooks/Zipper","notebooks/index","parser","pretty","stack","types"],envversion:52,filenames:["index.rst","joy.rst","lib.rst","library.rst","notebooks/Categorical.rst","notebooks/Developing.rst","notebooks/Generator_Programs.rst","notebooks/Intro.rst","notebooks/Newton-Raphson.rst","notebooks/NoUpdates.rst","notebooks/Ordered_Binary_Trees.rst","notebooks/Quadratic.rst","notebooks/Recursion_Combinators.rst","notebooks/Replacing.rst","notebooks/Treestep.rst","notebooks/Types.rst","notebooks/Zipper.rst","notebooks/index.rst","parser.rst","pretty.rst","stack.rst","types.rst"],objects:{"joy.joy":{joy:[1,1,1,""],repl:[1,1,1,""],run:[1,1,1,""]},"joy.library":{"void":[3,1,1,""],BinaryBuiltinWrapper:[3,1,1,""],DefinitionWrapper:[3,2,1,""],FunctionWrapper:[3,1,1,""],SimpleFunctionWrapper:[3,1,1,""],UnaryBuiltinWrapper:[3,1,1,""],add_aliases:[3,1,1,""],app1:[3,1,1,""],app2:[3,1,1,""],app3:[3,1,1,""],b:[3,1,1,""],branch:[3,1,1,""],choice:[3,1,1,""],clear:[3,1,1,""],cmp_:[3,1,1,""],concat_:[3,1,1,""],cond:[3,1,1,""],dip:[3,1,1,""],dipd:[3,1,1,""],dipdd:[3,1,1,""],divmod_:[3,1,1,""],drop:[3,1,1,""],dupdip:[3,1,1,""],floor:[3,1,1,""],genrec:[3,1,1,""],getitem:[3,1,1,""],help_:[3,1,1,""],i:[3,1,1,""],id_:[3,1,1,""],ifte:[3,1,1,""],infra:[3,1,1,""],initialize:[3,1,1,""],inscribe:[3,1,1,""],loop:[3,1,1,""],map_:[3,1,1,""],max_:[3,1,1,""],min_:[3,1,1,""],parse:[3,1,1,""],pm:[3,1,1,""],pred:[3,1,1,""],remove:[3,1,1,""],reverse:[3,1,1,""],select:[3,1,1,""],sharing:[3,1,1,""],shunt:[3,1,1,""],sort_:[3,1,1,""],sqrt:[3,1,1,""],step:[3,1,1,""],succ:[3,1,1,""],sum_:[3,1,1,""],take:[3,1,1,""],times:[3,1,1,""],unique:[3,1,1,""],unstack:[3,1,1,""],warranty:[3,1,1,""],words:[3,1,1,""],x:[3,1,1,""],zip_:[3,1,1,""]},"joy.library.DefinitionWrapper":{add_def:[3,3,1,""],add_definitions:[3,3,1,""],parse_definition:[3,3,1,""]},"joy.parser":{ParseError:[18,4,1,""],Symbol:[18,2,1,""],text_to_expression:[18,1,1,""]},"joy.utils":{generated_library:[3,0,0,"-"],polytypes:[21,0,0,"-"],pretty_print:[19,0,0,"-"],stack:[20,0,0,"-"],types:[21,0,0,"-"]},"joy.utils.generated_library":{ccons:[3,1,1,""],cons:[3,1,1,""],dup:[3,1,1,""],dupd:[3,1,1,""],dupdd:[3,1,1,""],first:[3,1,1,""],first_two:[3,1,1,""],fourth:[3,1,1,""],over:[3,1,1,""],pop:[3,1,1,""],popd:[3,1,1,""],popdd:[3,1,1,""],popop:[3,1,1,""],popopd:[3,1,1,""],popopdd:[3,1,1,""],rest:[3,1,1,""],rolldown:[3,1,1,""],rollup:[3,1,1,""],rrest:[3,1,1,""],second:[3,1,1,""],stack:[3,1,1,""],stuncons:[3,1,1,""],stununcons:[3,1,1,""],swaack:[3,1,1,""],swap:[3,1,1,""],swons:[3,1,1,""],third:[3,1,1,""],tuck:[3,1,1,""],uncons:[3,1,1,""],unit:[3,1,1,""],unswons:[3,1,1,""]},"joy.utils.polytypes":{AnyStarJoyType:[21,2,1,""],CombinatorJoyType:[21,2,1,""],FUNCTIONS:[21,6,1,""],FunctionJoyType:[21,2,1,""],IntJoyType:[21,2,1,""],KleeneStar:[21,2,1,""],NumberStarJoyType:[21,2,1,""],StackStarJoyType:[21,2,1,""],SymbolJoyType:[21,2,1,""],compose:[21,1,1,""],defs:[21,1,1,""],infer:[21,1,1,""],meta_compose:[21,1,1,""]},"joy.utils.polytypes.AnyStarJoyType":{kind:[21,5,1,""]},"joy.utils.polytypes.KleeneStar":{kind:[21,5,1,""]},"joy.utils.polytypes.NumberStarJoyType":{kind:[21,5,1,""]},"joy.utils.polytypes.StackStarJoyType":{kind:[21,5,1,""]},"joy.utils.pretty_print":{TracePrinter:[19,2,1,""]},"joy.utils.pretty_print.TracePrinter":{go:[19,7,1,""],viewer:[19,7,1,""]},"joy.utils.stack":{concat:[20,1,1,""],expression_to_string:[20,1,1,""],iter_stack:[20,1,1,""],list_to_stack:[20,1,1,""],pick:[20,1,1,""],stack_to_string:[20,1,1,""]},"joy.utils.types":{AnyJoyType:[21,2,1,""],BooleanJoyType:[21,2,1,""],FloatJoyType:[21,2,1,""],IntJoyType:[21,2,1,""],JoyTypeError:[21,4,1,""],NumberJoyType:[21,2,1,""],StackJoyType:[21,2,1,""],compilable:[21,1,1,""],compile_:[21,1,1,""],compose:[21,1,1,""],defs:[21,1,1,""],delabel:[21,1,1,""],doc_from_stack_effect:[21,1,1,""],reify:[21,1,1,""],relabel:[21,1,1,""],unify:[21,1,1,""]},"joy.utils.types.BooleanJoyType":{accept:[21,5,1,""]},"joy.utils.types.FloatJoyType":{accept:[21,5,1,""]},"joy.utils.types.IntJoyType":{accept:[21,5,1,""]},"joy.utils.types.StackJoyType":{accept:[21,5,1,""]},joy:{joy:[1,0,0,"-"],library:[3,0,0,"-"],parser:[18,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"],"2":["py","class","Python class"],"3":["py","classmethod","Python class method"],"4":["py","exception","Python exception"],"5":["py","attribute","Python attribute"],"6":["py","data","Python data"],"7":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:function","2":"py:class","3":"py:classmethod","4":"py:exception","5":"py:attribute","6":"py:data","7":"py:method"},terms:{"0b11100111011011":5,"23rd":15,"4b4cb6ff86e5":[],"58a8e44e9cba":[],"5bkei":10,"5eb7ac5ad2c2":[],"7fde90b4e88f":[],"\u03b5":8,"abstract":[7,10],"boolean":[2,3,7,10],"break":[7,15],"byte":5,"case":[2,3,12,14,15,20],"class":[3,7,15,18,19,20,21],"default":[3,6,10,20],"export":[3,18],"final":[2,10,12],"float":[3,7,15,16,18,21],"function":[0,1,4,5,6,9,11,16,17,18,19,20,21],"g\u00e9rard":16,"import":[2,5,6,8,10,11,12,13,14,15,16],"int":[6,7,12,15,16,18,20,21],"long":[10,15,17],"new":[2,3,6,7,9,12,13,15,21],"p\u00f6ial":17,"p\u00f6ial06typingtool":15,"public":9,"return":[1,3,5,7,10,12,13,14,15,18,19,20,21],"static":[2,9],"super":15,"switch":[2,15],"throw":[10,21],"true":[2,3,5,12,15,21],"try":[6,8,11,12,14,15],"void":[0,3],"while":[3,7,10,15,18,20],AND:15,Adding:[7,13,17],And:[5,6,8,10,12,15,16,20],But:[0,4,5,6,7,10,13,15],CPS:7,FNs:[],For:[2,3,10,12,13,15,17,20,21],Has:3,Its:3,Not:15,One:[2,7,15,17],TOS:[2,3],That:[5,10],The:[0,1,2,3,4,6,8,9,11,16,17,18,20,21],Then:[2,3,10,11,12,15],There:[11,12,14,15,20],These:[15,17,20,21],Use:[3,8,12],Using:[0,8,10,17],With:[8,12,15,17,21],_1000:15,__add__:15,__builtin__:21,__class__:15,__eq__:15,__ge__:15,__hash__:15,__init__:15,__main__:15,__name__:[],__radd__:15,__repr__:15,__str__:19,_dictionari:15,_ge:15,_infer:15,_interpret:15,_log:15,_log_it:15,_names_for:15,_to_str:15,_tree_add_:10,_tree_add_e:[10,21],_tree_add_p:10,_tree_add_r:10,_tree_add_t:10,_tree_delete_:10,_tree_delete_clear_stuff:[10,21],_tree_delete_del:10,_tree_delete_r0:[10,21],_tree_delete_r1:10,_tree_delete_rightmost:10,_tree_delete_w:10,_tree_get_:[10,21],_tree_get_p:10,_tree_get_r:10,_tree_get_t:10,_tree_iter_order_curr:10,_tree_iter_order_left:10,_tree_iter_order_r:10,_tree_iter_order_right:10,_tree_t:10,_treestep_0:14,_treestep_1:14,_uniqu:15,_within_b:8,_within_p:8,_within_r:8,a10001:15,a10002:15,a10003:15,a10004:15,a1001:[],abbrevi:14,abil:[],abl:[15,21],about:[0,7,10,15,16,20,21],abov:[0,5,8,10,12,15],abs:8,absolut:7,accept:[1,2,3,5,6,7,10,11,13,14,15,16,21],accordingli:10,accumul:5,act:21,action:[7,13,15,16],actual:[2,5,7,10,15],adapt:17,add:[3,5,6,7,13,15,19,21],add_alias:3,add_def:3,add_definit:[3,10,14],added:[4,10],adding:[9,15],addit:[0,2,3,5,7,12,13,14],address:17,adjust:[10,21],advantag:15,after:[5,6,7,12,15,21],afterward:7,again:[2,3,5,7,10,12,15,21],against:[15,21],aggreg:16,ahead:15,aka:[7,16,21],albrecht:0,algorithm:[7,15],alia:[3,21],alias:[3,7],align:[7,19],all:[3,5,6,7,10,12,13,14,15,19,21],alloc:15,allow:[9,10],almost:10,along:[7,12,15,21],alphabet:3,alreadi:[8,13,15,16],also:[0,5,7,10,15,20,21],alter:15,altern:[4,15,21],although:[4,10],altogeth:6,alwai:[5,9,12],amaz:[],among:15,amort:10,analysi:[4,17],anamorph:[7,17],ani:[4,5,7,9,10,15,16,18,21],annual:7,anonym:10,anoth:[10,15,20,21],anyhow:15,anyjoytyp:[15,21],anymor:15,anystarjoytyp:[15,21],anyth:[2,3,7,15,21],apart:15,api:9,app1:3,app2:[3,7,11,12,13],app3:3,app:7,appear:[2,4,5,10,21],append:15,appendix:17,appli:[2,3,5,6,10,12,15,21],applic:6,approach:5,approxim:17,archiv:0,aren:16,arg:[2,3],argument:[2,3,7,8,11,12,17,19,20],arithmet:2,ariti:2,around:[5,15,20],arrang:14,arriv:[6,14],articl:[0,4,6,12],ask:[4,6,15],aspect:0,assert:15,assign:20,associ:10,assum:8,astar:[],asterisk:14,asterix:[15,21],attack:7,attempt:[0,1,15],attribut:3,attributeerror:15,author:15,auto:[0,15,21],automat:[4,15,21],auxiliari:14,avail:[0,15,21],averag:[7,13],avoid:[10,21],awai:[10,15],awar:2,awkward:[10,12,15],azur:17,back:[10,15],backport:[],backtrack:21,backward:[9,10,11,14],bad:15,bag:7,banana:12,barb:12,base:[0,2,3,9,12,14,15],basic:[1,2,3,7,10],basicconfig:15,becaus:[2,3,7,10,14,15,16,20],becom:[10,14,20],becuas:15,been:[8,9,10,15,16],befor:[6,7,10],begin:[10,14],behavior:[9,14,21],behaviour:[0,1,15,21],being:[0,21],below:[2,3,5,6,10,15,16],bespok:7,best:0,better:[5,10,12,15],between:[0,5,21],beyond:6,biannual:7,binari:[0,6,7,17],binary_search_tre:10,binarybuiltinwrapp:3,bind:7,bingo:16,bit:[5,6,10,15],bliss:[0,17],block:5,bodi:[2,7,10],body_text:3,booktitl:15,bool:[12,15,21],booleanjoytyp:21,borrow:[7,15],both:[2,5,7,11,12,13,15,20],bottom:6,bracket:[7,15,18],branch:[3,5,6,12,15,21],branch_fals:15,branch_tru:15,breakpoint:7,bring:[5,7,15],broken:[],bruijn:15,brzozowski:15,btree:[10,14],buck:10,bug:[0,7],build:[6,7,11,12,16,20],built:[11,15],bundl:[2,3,12],burgeon:7,calculu:4,call:[2,7,9,10,12,15,19,20],caller:[10,15],can:[0,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,20,21],cannot:15,captur:[7,21],card:7,care:[5,20],carefulli:16,carri:[6,10,21],cartesian:4,catamorph:17,categor:[0,17],categori:4,ccc:4,ccon:[3,10,15,21],cell:[12,15],certain:[7,20],certainli:10,chain:3,chang:[2,9,10,15,16],charact:16,chat:7,chatter:[0,15],check:[6,8,15],checker:[],child:14,choic:[3,12],choos:9,chop:11,cinf:10,circuit:4,cite_not:10,classmethod:3,claus:[3,15],clean:15,clear:[3,5,7,21],clear_stuff:10,cleav:[7,11,13],close:[0,1,4],clunki:[5,15],cmp:[3,14,17],cmp_:3,code:[0,1,4,11,12,15,17,21],codireco:[6,8],collaps:12,collect:[4,6,7,15],collis:21,combin:[0,3,5,6,7,8,11,14,16,17,21],combinatorjoytyp:[15,21],combo:[],come:[7,10,15],command:[7,10,15],comment:21,common:[2,5],compar:[3,4,15],comparison:[0,10],compel:4,compil:[2,4,7,10,13,17,21],compile_:21,complet:4,complex:[3,15,16,21],complic:15,compos:21,composit:[15,21],compostit:15,compound:10,comput:[2,4,5,7,11,15,21],con:[3,5,6,7,8,10,11,12,14,16,20,21],conal:4,concat:[3,6,7,14,15,20],concat_:[3,21],concaten:0,concatin:[0,3,20],conclus:17,concurr:2,cond:[3,10],condit:[3,7],confer:15,conflict:[10,15,21],conjectur:[],consecut:17,consid:[5,6,10,12,14,15,16],consist:[2,6,7,14],constant:10,constitu:12,constraint:[],construct:15,consum:15,contain:[0,2,3,6,7,12,15],content:15,context:2,conting:10,continu:[0,12,15,16],control:7,conveni:[4,15],convers:15,convert:[12,13,14,15,18,20],cool:10,copi:[2,3,5,10,12,14,17],copyright:7,correct:[],correspond:4,could:[2,4,5,7,9,10,15,16],count:[3,15],counter:[5,15],coupl:14,cours:[5,10,15],cover:15,crack:10,crap:[],crash:10,creat:[0,2,3,5,8,10,15],creativ:15,crude:[10,15,18,21],cruft:15,crunchi:[],curent:21,currect:[],current:[2,3,7,12,14,15,16,19,21],custom:9,cycl:[5,6],cython:7,dai:7,data:[2,3,12],datastructur:[0,2,12,15,17,18,20],datatyp:20,ddee30dbb1a6:[],ddididi:16,deal:[0,10],dealt:15,debugg:15,decid:10,declar:15,decor:3,decoupl:12,decrement:3,deduc:[5,15],deeper:0,deepli:4,def:[3,7,12,13,15,20,21],defaultdict:15,defi:3,defin:[2,3,4,5,6,7,8,9,11,12,13,15,16,17],definit:[2,3,5,6,7,9,10,12,14,15,17,21],definitionwrapp:[3,10,12,14],delabel:21,deleg:7,delet:17,deliber:15,demo:15,demonstr:4,depend:[3,10,12],deposit:14,depth:[15,21],dequot:12,der:10,deriv:[2,3,5,7,8,10,15,17],describ:[3,4,10,12,14,15,18,21],descript:[5,7],descriptor:15,design:[2,3,10,17],desir:[7,14],destruct:10,detail:[7,10,15],detect:[6,10,12,15],determin:17,develop:[0,6,7,15,17],diagram:5,dialect:1,dict:[1,3,15,21],dictionari:[0,1,3,7,15,17],did:15,differ:[0,4,5,8,10,11,12,20],differenti:4,difficult:15,dig:[10,16],digit:5,dinfrirst:[7,15,21],dip:[3,5,6,7,8,10,11,12,13,14,15,17,21],dip_a:[],dip_t:[],dipd:[3,6,7,10,11,12,15,16,21],dipdd:[3,10,21],direco:17,direct:7,directli:[5,14,15,20],disappear:[2,15,21],discard:[3,6,8,10,12],disciplin:10,disenstacken:7,disk:7,displac:2,displai:15,distiguish:15,ditch:10,div:[3,7,15,21],dive:14,divis:10,divmod:[3,21],divmod_:[3,15],doc:[2,3,7,15,21],doc_from_stack_effect:21,docstr:[15,21],document:[15,17,18,20],doe:[0,1,4,6,7,13,15,17,19,21],doesn:[5,9,10,14,15,20],doing:[4,5,7,15,16],domain:[4,15],don:[5,7,10,15,21],done:[2,5,7,9,15],dooooc:15,door:7,dot:19,doubl:[5,7,15],down:[2,8,12,16,21],down_to_zero:7,dozen:7,draft:[4,9],dream:7,drive:[6,8],driven:5,driver:6,drop:[3,10],dudipd:7,due:15,dup:[3,5,6,7,8,10,11,12,16,20,21],dupd:[3,15,21],dupdd:[3,21],dupdip:[3,5,10,11,12,21],duplic:[3,10,12],durat:2,dure:[2,12],each:[2,3,4,5,7,12,13,14,15,19,21],easi:[0,10,14,15,16],easier:[3,10],easili:4,edit:17,effect:[2,3,7,16,17,21],effici:[6,13,16],efg:15,either:[1,2,3,10,12,15],elabor:15,eleg:[0,7,10,17],element:2,elif:15,elimin:15,elliott:4,els:[2,3,12,15],else_:15,embed:[4,10,16],emit:15,empti:[3,7,14,15,20,21],encapsul:7,enclos:7,encod:6,encount:15,end:[5,10,12,14,15,20],endless:6,enforc:[2,7],engend:7,enorm:[],enough:[7,12,19,21],enstacken:[6,7,15],enter:7,enter_guard:15,entir:20,entri:[3,16,19],enumer:15,ephasi:[],epsilon:8,equal:[5,14,20],equat:[7,8],ergo:10,err:10,error:[7,15,18],essai:0,establish:15,etc:[3,14,15,16,18],euler:17,euro:15,eval:[0,15],evalu:[1,2,3,7,8,10,11,12,13,14,15],event:[],eventu:15,ever:15,everi:6,everyth:[3,10,11,15],evolv:9,examin:12,exampl:[0,3,5,15,17,18,20,21],exce:6,except:[7,10,15,18,21],execut:[0,1,2,3,7,12,13,14,15,16,20,21],exend:15,exercis:10,exist:[4,10,15],expand:10,expect:[2,3,14,15,20,21],experi:[7,14],explain:15,explan:7,explor:[7,15],express:[0,1,2,3,4,10,12,13,15,16,19,20],expression_to_str:[15,20],extend:15,extra:[5,6],extract:[10,11,17],extrem:7,extrememli:7,f1001:[],f_g:15,f_in:15,f_out:15,f_python:15,facet:0,facil:7,fact:18,factor:[2,5,7,10,15],factori:17,fail:[2,3,10,18],fairli:15,fale:[],fall:15,fals:[2,3,5,12,15,21],falsei:15,far:[8,10,12,15,21],fascin:0,fear:[10,15],few:[5,7,8,11,15],fewer:[3,7],fg_in:15,fg_out:15,fib:6,fib_gen:6,fibonacci:17,figur:[2,3,10,12,15],filter:10,fin:5,find:[2,3,5,6,14,15,17],finder:8,fine:[0,5,10,15,21],first:[3,6,7,8,10,11,12,13,14,16,17,21],first_two:[3,10,21],fit:[5,7],five:[5,7,17],fix:[2,3,12,15,21],fixm:15,flag:15,flatten:[7,14,15],flexibl:17,floatjoytyp:[15,21],floatstarjoytyp:15,floor:3,floordiv:[5,21],flow:7,follow:[0,2,3,7,9,12,14,15,16,21],foo:[7,9,10,15],foo_ii:9,form:[2,3,4,5,6,12,14,15,20],forman:7,format:[15,17,19],formula:[0,5,17],forth:[7,15],forum:0,forward:15,found:7,foundat:[],four:[2,3,5,6,7,10,17],fourteen:5,fourth:[2,3,10,12,21],fractal:7,fraction0:7,fraction:[2,7],frame:12,framework:7,free:[4,7,10],freeli:2,from:[0,1,2,3,5,6,7,8,10,11,12,13,14,15,16,17,20],from_iter:[],front:[2,3,12],full:5,fulli:[],fun:17,func:15,functionjoytyp:[15,21],functionwrapp:3,funtion:10,further:[8,15,17],g_in:15,g_out:15,garbag:7,gari:10,gcd:7,gener:[0,2,4,12,15,17,20,21],generated_librari:3,genrec:[3,7,10,12,14,15],geometr:5,get:[2,4,5,6,7,11,12,15,17],getitem:3,getrecursionlimit:20,getsourc:7,ghc:4,give:[4,5,10,12,14,15,20],given:[2,3,5,6,8,10,12,15,16,17],global:15,glue:7,goe:21,going:[10,11,14,15,16],good:[5,10,15],grab:[3,15],grammar:18,grand:7,great:[0,7,15,17],greater:20,grind:15,grok:[],group:0,gsra:8,guard:[10,15,21],had:[5,16],haiku:7,half:[5,15,16],hand:[7,13,15,17],handi:[8,15],handl:[10,15,20,21],happen:[7,15],hard:[15,16],hardwar:4,has:[0,2,6,7,8,9,10,12,15,16,20],hasattr:15,hash:15,haskel:4,have:[2,3,5,6,7,8,9,12,13,15,16,17,20,21],haven:[],head:20,heh:15,help:[7,10,12,15],help_:3,helper:3,herd:7,here:[5,6,10,14,15,16,21],hide:10,hierarchi:15,higher:[7,10,15],highli:7,histori:[15,19,21],hmm:10,hoist:3,hold:[5,15],hood:10,hope:[0,5,7,17],hopefulli:12,host:17,how:[0,4,8,10,12,15,16,17],howev:[12,13,15],html:[2,3,6,11,12,17],http:10,huet:16,huge:10,hugh:[8,14],human:7,hybrid:21,hylomorph:17,hypothet:2,id_:3,idea:[4,5,7,15],ident:[3,12,15,21],if_not_empti:10,ift:[3,10,12,14,15,21],ignor:[3,10,15],iii:17,illustr:12,imagin:16,imap:15,imit:14,immedi:12,immut:[7,10],imper:12,implement:[0,1,2,3,4,7,9,10,12,13,17,21],impli:[],implicit:7,improv:15,includ:[4,10,14,15,21],inclus:5,incom:20,incompat:9,incorpor:11,increas:5,increment:[3,4,5,9],index:[0,7,15,20],indexerror:20,indic:[14,15,21],ineffici:15,infer:0,inferenc:21,info:15,inform:[3,15,21],infra:[3,6,7,10,11,13,14,15,17,21],infrastructur:3,initi:[2,3,7,8,10,15],inlin:10,inner:15,inproceed:15,input:[1,8,15,21],inscrib:3,insert:15,insight:12,inspect:7,inspect_stack:15,instal:0,instanc:[15,21],instanti:[4,19],instead:[5,6,10,12,15,16,20,21],integ:[2,3,7,12,14,15],integr:3,intend:[0,7],interact:[7,17],interest:[0,5,10,15,17],interlud:17,intermedi:12,intern:[0,15,19,20],interpret:[0,4,9,13,18,19,21],interrupt:7,interv:[4,5],intjoytyp:[15,21],introduc:[9,21],introduct:0,intstarjoytyp:15,intuit:15,invalid:21,invari:3,invent:15,involv:15,ipf:7,ipython:[],isinst:15,isn:[10,16],issubclass:15,item:[2,3,7,10,12,14,15,17,20],iter:[1,3,7,12,14,15,17,20],iter_stack:[13,20],iteritem:15,itertool:15,its:[0,2,3,4,5,7,10,12,14,15,20],itself:[0,2,7,10,15,21],j05cmp:[2,3,12],jaanu:15,job:17,john:[8,14],joi:[2,4,9,10,11,13],join:15,joypi:[7,16],joytypeerror:21,june:[],junk:15,jupyt:17,just:[0,2,3,6,7,9,10,12,14,15,16],kav:[],keep:[10,11,15,16],kei:[14,17],kevin:0,key_n:10,keyerror:[10,15],kind:[2,4,7,10,12,14,15,21],kinda:15,kjs:[],kleen:[14,15,21],kleenestar:[15,21],kleffner:15,know:[5,10,15],knowledg:15,known:4,l2s:[],l_kei:10,l_left:10,l_right:10,l_valu:10,label:15,lambda:[4,15],languag:[4,7,9,10,13,15],larg:15,larger:20,largest:3,last:[5,10,12,15],lastli:6,later:[7,14,15],law:2,lazi:15,lazili:8,lcm:5,lead:[7,15,21],leaf:10,lean:7,learn:0,least:[2,5,12,15,20],least_fract:7,leav:5,left:[7,11,12,14,15,16,19,20,21],leftov:12,len:15,length:[3,5,20],lens:12,less:[5,6,7,12,15,20],let:[6,8,10,11,12,14,15,16],letter:15,level:[4,10,15],librari:[0,13],like:[2,3,5,7,14,15,17,18,21],limit:[15,21],line:[3,7,10,11,15,19,21],linear:20,link:[0,15],linux:0,list:[0,3,5,7,8,10,12,14,15,16,19,21],list_to_stack:[15,20],lit:[],liter:[1,10,14,15,16,18],literatur:15,littl:[6,10,15,17],live:17,lkei:14,load:[5,7],local:15,locat:2,locu:19,lof:[],log:15,log_2:10,logic:[0,5,17],longer:[10,15],look:[6,7,8,10,11,15],lookup:7,loop:[0,1,3,5,15,21],lose:15,lot:[7,10,15,16],love:5,low:4,lower:5,lowercas:15,lowest:10,lshift:21,machin:0,machineri:[10,15,21],macro:7,made:[0,7,15,16],magic:15,mai:[2,12],mail:0,main:[0,3,7,11,15,16],mainloop:9,maintain:16,major:9,make:[2,3,4,5,7,10,12,13,14,15,16,17],make_gener:8,manfr:[0,2,3,4,12],mani:[0,7,15],manipul:15,manner:11,map:[1,3,5,7,9,12,14,15],map_:3,marker:7,mask:[5,6],match:[0,1,15],materi:0,math:[0,7,8,10,11,15],mathemat:7,matter:[5,8,10,14],max_:3,maximum:3,mayb:[10,15],mean:[4,5,7,8,10,12,14,15,20,21],meant:[7,10,12,14],member:[2,3,12],mental:7,mention:2,mercuri:0,mess:15,messag:15,meta:[7,10,13],meta_compos:[15,21],metal:[],method:[0,3,7,15,17,19],midpoint:5,might:[4,6,10,15],mike:10,million:6,min_:3,mind:15,minimum:3,minor:10,minu:3,mirror:0,miscellan:0,mismatch:15,mix:[7,15],mod:3,mode:15,model:[4,7],modern:0,modif:[6,15],modifi:[7,10,16],modul:[0,1,3,7,15,18],modulu:[7,21],moment:15,month:7,more:[0,3,4,5,6,7,8,12,13,14,15,18,20,21],most:[15,21],mostli:0,motiv:[],move:10,movement:2,much:[5,6,10,12,15],muck:10,mul:[7,11,16,19,21],multi:3,multipl:[17,21],must:[2,3,5,9,12,14,15],myself:15,n10001:15,n10002:15,n10003:15,n1001:15,n1002:15,n1003:15,name:[1,3,7,9,10,12,15,16,17,18,20,21],narr:15,natur:[5,6,10,15],navig:16,nearli:15,neat:10,neato:15,necessarili:15,need:[2,3,5,6,8,9,10,12,15],neg:[3,11,21],neither:15,nest:[3,7,10,16],network:7,never:[9,12],new_def:15,new_f:15,new_fo:15,new_kei:10,new_valu:10,newton:[0,17],next:[5,14,15,21],nice:[0,12,20],niether:2,node:[14,17],node_kei:10,node_valu:10,non:[14,15,21],none:[1,3,15,21],nope:14,normal:[],notat:[7,10],note:[2,5,8,10,12,15,20],notebook:[5,6,7,15,16,17],notebook_preambl:[2,5,6,8,10,11,12,13,14,15,16],noth:[2,10],notic:5,now:[5,6,7,12,13,14,15,17],nth:[3,20],nullari:[7,10,15,21],number:[1,2,3,5,6,8,20,21],numberjoytyp:[15,21],numberstarjoytyp:[15,21],numer:15,object:[15,18],observ:5,obviou:6,obvious:15,occur:10,odd:[5,6],off:[2,3,5,6,11,15,16],okai:[],old:[2,13],old_k:10,old_kei:10,old_valu:10,omit:[12,15],onc:[3,9,10],one:[2,3,5,6,10,12,14,15,19,20,21],ones:[6,15],onli:[2,3,5,10,12,15,16,20,21],onto:[1,2,3,7,12,20],open:[7,15],oper:[3,7,10,12,20],oppos:15,optim:10,option:[1,7,10,15,20],order:[0,2,3,7,12,15,17,20],org:[0,10],origin:[0,1,2,3,10,16],other:[0,2,3,4,7,10,12,14,15,20,21],otherwis:[3,5,6,10,14,15,21],our:[5,6,7,8,12,14,15],out:[2,3,4,5,6,7,8,10,11,12,15,16],outcom:14,output:[8,12,15,21],outsid:4,over:[3,4,5,6,7,8,10,11,14,15,17,21],overhaul:15,overview:15,own:[10,15],pace:[],pack:20,packag:[0,7],page:[0,10,15,20],pair:[2,3,5,6,10,15],palidrom:5,palindrom:5,pam:7,paper:[4,7,12,16],paradigm:17,parallel:2,paramet:[1,2,3,12,13,18,19,20],parameter:17,paramorph:12,parenthes:[10,20],pariti:6,pars:[0,3,7],parse_definit:3,parseerror:18,parser:[0,15],part:[2,3,8,12,14,17],partial:15,particular:16,pass:[0,10,15,19,21],path:[15,17],pattern:[5,14,17],pe1:[5,6],pe2:6,pearl:16,pend:[3,7,12,15,16,19],peopl:17,per:[7,14],perform:15,perhap:6,period:7,permit:[15,20],permut:15,persist:10,phase:2,pick:[5,6,20],pickl:7,pictur:10,piec:12,pip:0,place:[3,5,7,15],plai:0,plu:3,plug:[6,12,14],point:[4,7,10,12],pointless:2,poly_typ:[],polytyp:[0,15],pop:[3,5,6,7,10,12,13,14,20,21],popd:[3,7,8,10,13,15,21],popdd:[3,6,11,15,21],popop:[3,5,6,7,8,10,14,15,21],popopd:[3,21],popopdd:[3,21],posit:[3,5,7,12],possibilit:10,possibl:[10,14,15,17],post:7,poswrd:15,pow:21,power:[7,15],pragmat:5,preambl:8,precis:[0,1],pred:[3,15,21],predic:[2,3,6,12],prefix:[15,19],present:15,preserv:[4,14],pretti:[8,10,11,14,15,19,20],pretty_print:0,previou:7,primari:[],prime:8,primit:[2,3,15,17],primrec:[3,6,7,8,12],principl:[],print:[0,1,2,3,15,19,20,21],probabl:[6,7,10,15],problem:[7,15,17],proc_curr:10,proc_left:10,proc_right:10,proce:[5,21],process:[7,14,15,19],produc:[5,10,12,14,15],product:[6,7,15,21],program:[0,2,3,6,7,8,10,12,15,16,21],programm:15,progress:[],project:17,prolog:15,prompt:7,proper:[2,3,12,21],properti:0,provabl:[],proven:[],provid:[0,3,4,7,15,21],pun:[0,7],punctuat:15,pure:0,puriti:7,purpos:7,push:[2,3,7,12,16,20],pushback:7,put:[1,2,6,7,15,17,20],pypi:0,python:[0,2,3,10,12,16,17,18,20,21],quadrat:[0,17],queri:[10,14],query_kei:14,queu:12,quit:[0,1,14],quot:[0,3,6,7,10,11,12,14,15,16,19,21],quotat:[2,3,12],quotient:3,r_kei:10,r_left:10,r_right:10,r_valu:10,rais:[10,15,18,20],rang:[7,15],range_revers:12,range_to_zero:7,ranger:12,ranger_revers:12,raphson:8,rather:[5,7,12,14],ratio:7,reach:[5,6,12],read:[0,1,5,6,10,15,16],readabl:13,reader:10,readi:15,real:10,realiz:[4,10],rearrang:[2,10,15],reason:[5,7,15],rebuild:[14,16],rec1:[2,3,12],rec2:[2,3,12],recent:[],recogn:18,record:[7,19],recur:[12,15],recurs:[0,2,3,6,7,8,15,17,20],recus:7,recycl:[],redefin:17,redistribut:[3,7],reduc:[2,15],redund:20,refactor:[7,9],refer:[0,2],regist:2,regular:[15,18],reifi:21,reimplement:17,relabel:21,relat:15,releas:9,remain:[2,7,9,15],remaind:[3,8],remind:15,remov:[3,10,15,20],render:17,repeat:5,repeatedli:5,repl:[0,1],replac:[0,2,3,6,11,12,14,15,16,17,20],repositori:0,repr:15,repres:[2,7,10,18,19,21],represent:[20,21],reprod:6,repurpos:15,requir:[15,20],res:15,research:15,resembl:7,respect:5,rest:[3,5,6,7,10,12,16,17,20,21],rest_two:10,restat:[],restor:2,restrict:[],result:[1,2,3,5,10,11,12,14,15,16],resum:7,retain:[],retir:2,retri:7,reus:[10,15],revers:[3,5,6,12,15,16,20],revisit:15,rewrit:[3,7,15],rewritten:7,rich:[],rid:10,right:[6,7,11,14,15,17,19,20,21],rightest:10,rightmost:5,risk:15,rkei:14,rob:15,robot:[],roll:[3,8,10,14],roll_dn:15,roll_down:[],roll_up:[],rolldown:[3,15,21],rollup:[3,15,21],root:[3,8,11],round:15,rrest:[3,15,21],rshift:21,rule:17,run:[0,1,3,5,7,8,10,11,12,14,15,16],runtimeerror:20,s1000:[],s1002:[],s10:[],s23:[],sai:[6,10,11,14,15],same:[2,4,5,10,15,20],sandwich:[2,3,12],save:[2,5,7],scan:3,scanner:[7,18],scenario:16,scope:[6,10],search:[0,10],sec:[15,21],second:[3,7,10,12,14,20,21],section:12,see:[0,6,7,8,9,11,12,13,15,16,19],seem:[0,5,7,14,15,21],seen:[15,16,21],select:3,self:15,semant:[2,3,7,9,10,15],semi:7,send:7,sens:[0,2,5,15,16],separ:[7,15],seq:15,sequenc:[0,1,2,3,5,7,10,12,13,16,17,18,21],sequence_to_stack:15,seri:[5,6,10,16],ses:15,set:[2,3,12,15,17],seven:[5,6],sever:[0,4,7,12],share:[3,7],shelf:2,shift:[5,6],shorter:17,shorthand:10,should:[2,3,5,10,12,15],shouldn:7,show:[4,15,16],shunt:[3,16],side:[10,15,21],signatur:21,signifi:[7,10],similar:[10,14,15],simon:7,simpl:[7,12,20,21],simplefunctionwrapp:[3,13,15],simpler:14,simplest:[15,17],simpli:4,simplifi:[5,10,16],sinc:[2,5,10,15],singl:[3,6,7,13,15,18,21],situ:10,situat:10,six:[5,6,7],sixti:[5,6],size:[7,17],skeptic:7,skip:15,slight:8,slightli:[10,12,15],smallest:3,smart:10,softwar:7,solei:2,solut:[5,6],solvabl:7,some:[2,3,6,7,10,12,14,15,17,20,21],somehow:[10,15],someth:[2,9,10,15],sometim:10,somewher:[10,17],sort:[3,10,15],sort_:3,sorta:[],sourc:[0,1,3,15,17,18,19,20,21],space:[5,19],span:5,spawn:15,special:[6,10,17],specif:[0,4],specifi:[10,21],speed:13,spell:14,sphinx:[17,20,21],spirit:[0,1,14],split:[15,21],sqr:[7,8,11,16],sqrt:[3,8,15,21],squar:[3,8,15,18],squishi:[],stack:[0,1,3,5,6,8,10,11,12,13,14,16,17,18,19,21],stack_concat:[],stack_effect:15,stack_effect_com:15,stack_to_str:20,stacki:15,stackjoytyp:[15,21],stackstarjoytyp:[15,21],stage:14,stai:[0,1],stand:[4,21],standard:[7,10],star:[14,15,21],stare:10,start:[5,6,7,8,10,12,14,15,21],state:7,statement:3,stdout:15,step:[3,5,7,10,13,15,16,17],still:[10,15],stop:10,storag:[5,10],store:[5,12,15],stori:12,str:[1,15,18,19,20],straightforward:[1,6,8,15,17],stream:[5,15],stretch:10,string:[1,2,3,7,15,16,18,19,20,21],strip:[],structur:[7,14,15,16,17,20],stuff:[10,15],stuncon:[3,21],stununcon:[3,21],style:[0,4,15],sub:[9,21],subclass:7,subject:16,subset:[15,21],substitut:[10,15,21],subtract:5,subtyp:17,succ:[3,15,21],succe:15,success:8,suck:15,suffic:15,suffici:10,suffix:15,suggest:[4,10],suitabl:[3,4,5],sum:[3,6,7,11,12,13,14,21],sum_:[3,15],summand:5,sumtre:14,suppli:[10,18],support:[7,15,19,20],suspect:2,swaack:[3,11,13,15,16,21],swap:[3,5,6,7,8,10,12,13,14,16,21],swarm:[],swon:[3,6,7,12,14,15,16,21],swoncat:[6,7,8,12,14],swuncon:12,symbol:[2,3,15,16,17,18],symboljoytyp:[15,21],symmetr:[5,10],syntact:7,syntax:[7,20],sys:[15,20],system:[7,10],tabl:15,tag:15,tail:[10,15,17,20],take:[3,5,7,8,10,12,15,20],talk:[7,10,15,20],target:16,tast:4,tbd:7,tear:12,technic:2,techniqu:[4,16],technolog:2,temporari:16,ten:5,term:[1,2,7,8,12,15,17,18,20,21],termin:[2,3,12],ternari:7,test:[2,3,12],text:[0,1,3,15],text_to_express:[7,18],textual:7,than:[0,3,5,6,7,8,12,14,15,20,21],thei:[2,5,6,7,10,12,15,16,18,20,21],them:[2,3,5,6,10,12,15,16,17,21],themselv:[15,21],theori:[2,3,12],therefor:6,thi:[0,1,2,3,4,5,6,7,8,11,12,14,15,16,17,18,19,20,21],thing:[2,6,10,12,15,16,18,20,21],think:[2,5,7,10,12,14,15],third:[3,6,7,10,21],thirti:5,those:[2,3,10,12,15,17,21],though:5,thought:7,thousand:5,thread:2,three:[2,3,5,7,10,11,14,15,17],through:[1,5,7,14,15,16,20,21],thun:[2,3,4,9,12],thunder:7,time:[3,5,7,8,10,12,15,16],titl:15,to_set:10,todai:7,todo:[7,18],togeth:[6,7,15,17],token:18,toler:17,too:[12,15],tool:[7,15],tooo:15,top:[2,3,7,12,15,19,20],total:5,tower:15,trace:[0,7,11,12,16,17,20],traceback:[],traceprint:19,track:[11,15,16],tracker:0,transform:4,translat:[4,11,15],trash:[],travers:[0,17],treasur:0,treat:[0,2,3,12,15,17],treatment:6,tree:[0,7,17],treegrind:17,treestep:[0,17],tri:5,triangular_numb:12,trick:[5,15],tricki:15,trobe:0,trove:0,truediv:21,truli:[],trust:[],truthi:[3,7,15],tuck:[3,7,15,21],tupl:[3,7,15,20,21],ture:[],turn:[2,3,15,21],twice:[10,12],two:[2,3,5,7,8,10,11,12,14,15,16,17,20,21],type:[0,1,4,7,10,12,17,18,19,20],typeerror:15,typeless:15,typic:[2,3,11,12],unari:7,unarybuiltinwrapp:3,unbalanc:[10,18],unbound:21,unchang:10,uncompil:15,uncon:[3,6,7,10,12,14,16,21],under:[2,3,7,10],underli:15,underscor:15,understand:[0,10],undistinguish:10,undocu:7,unend:[],unfinish:[],unfortun:20,unicod:15,unif:15,unifi:21,uniqu:[3,10,15],unit:[3,7,12,21],univers:[0,7,15,21],unnecessari:17,unnecesssari:15,unpack:[2,3,10,20],unpair:5,unquot:[7,14],unstack:[3,15],unswon:[3,21],untangl:12,until:6,unus:5,unusu:10,updat:[0,17,21],usag:7,use:[0,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,20],used:[3,4,7,10,12,15,16,18,20,21],useful:[0,15],user:14,uses:[2,5,12],using:[3,6,10,11,12,14,16,21],usual:[0,2,12],util:[0,3,13,15],valid:15,valu:[0,2,3,5,7,8,11,12,13,14,15,17,20,21],value_n:10,valueerror:[15,20],variabl:[15,17,21],variant:10,variat:[12,17],varieti:[4,7],variou:0,vener:20,verbos:4,veri:[0,1,4,7,10,20],verifi:[],versa:[2,15],version:[0,1,2,6,9,14,16,17],via:7,vice:[2,15],view:[10,17],viewer:[1,7,9,19],vii:17,visibl:15,von:[0,2,3,4,12],wai:[0,2,3,4,5,7,12,13,15],wait:[],want:[2,5,6,8,10,12,15],warranti:[3,7],wash:7,wast:7,web:20,websit:[0,5],welcom:7,well:[0,4,7,8,10,15,18],went:15,were:[7,15,16],what:[2,3,4,7,10,12,14,15,19],whatev:[2,3,12,14,20],when:[5,6,7,10,12,15,16,18,20,21],where:[2,3,7,10,12,15,17,20],whether:12,which:[0,1,3,5,7,8,10,12,14,15,16,20,21],whole:[2,3,5,12,14,15],whose:6,why:[8,14],wiki:10,wikipedia:[0,10,16],wildli:7,wind:7,wire:12,within:[7,10,13,17],without:[2,7,10,11,15],won:[10,15,20],word:[0,3,5,7,12,16],work:[0,3,5,6,7,8,10,11,12,14,16,20,21],worth:5,would:[2,5,6,7,8,10,12,15,16,20,21],wrap:[3,7],wrapper:15,write:[4,8,10,12,14,15,16,17,20],written:[0,1,8,10,13,15,20],wrong:2,wrote:15,xrang:15,yang:15,year:[7,15],yet:[10,15,16],yield:[2,3,12,15,20,21],yin:17,you:[0,2,3,5,6,7,9,10,11,12,13,14,15,16,19,20],your:[2,3,7,12,15],yourself:[7,10],zero:[3,10,12,14,15,18,20,21],zip:[5,15],zip_:3,zipper:[0,17],zstr:16},titles:["Thun 0.2.0 Documentation","Joy Interpreter","Functions Grouped by, er, Function with Examples","Function Reference","Categorical Programming","Developing a Program in Joy","Using <code class=\"docutils literal notranslate\"><span class=\"pre\">x</span></code> to Generate Values","Thun: Joy in Python","Newton\u2019s method","No Updates","Treating Trees I: Ordered Binary Trees","Quadratic formula","Recursive Combinators","Replacing Functions in the Dictionary","Treating Trees II: <code class=\"docutils literal notranslate\"><span class=\"pre\">treestep</span></code>","The Blissful Elegance of Typing Joy","Traversing Datastructures with Zippers","Essays about Programming in Joy","Parsing Text into Joy Expressions","Tracing Joy Execution","Stack or Quote or Sequence or List\u2026","Type Inference of Joy Expressions"],titleterms:{"abstract":[],"case":[8,10],"function":[2,3,7,8,10,12,13,14,15],"long":13,"new":10,"p\u00f6ial":15,"void":2,"while":2,Adding:10,One:[6,10],The:[5,7,10,12,14,15],There:7,Using:6,With:14,about:17,add:[2,10],adding:10,address:16,altern:14,ana:12,analysi:5,anamorph:[2,12],app1:2,app2:2,app3:2,appendix:[10,12,15],approxim:8,argument:15,auto:3,averag:2,base:[8,10],binari:[2,10,14],bliss:15,both:10,branch:[2,10],can:10,cata:12,catamorph:12,categor:4,chatter:2,child:10,choic:2,clear:2,cleav:2,cmp:10,code:[7,10],combin:[2,10,12,15],comment:15,compar:10,comparison:2,compil:[6,15],compile_:15,compos:15,comput:8,con:[2,15],concat:2,conclus:[12,15],consecut:8,continu:7,current:10,datastructur:[7,10,16],deal:15,defin:[10,14],definit:11,delabel:15,delet:10,deriv:[11,12,14],design:12,determin:16,develop:5,dialect:0,dictionari:13,dip:[2,16],dipd:2,dipdd:2,direco:6,disenstacken:2,distinguish:15,div:2,doc_from_stack_effect:15,document:0,doe:10,down_to_zero:2,drop:2,dup:[2,15],dupd:2,dupdip:2,effect:15,eleg:15,els:10,empti:10,enstacken:2,equal:10,essai:17,euler:[5,6],eval:7,even:6,exampl:[2,7,10,12,14],execut:19,express:[7,18,21],extract:14,factori:12,fibonacci:6,filter:5,find:[8,10,12],first:[2,5,15],five:6,flatten:2,flexibl:14,floordiv:2,formula:11,found:10,four:12,fun:12,further:5,gcd:2,gener:[3,5,6,8],genrec:2,get:[10,14],getitem:2,given:14,greater:10,group:2,have:[10,14],help:2,highest:10,host:0,how:[5,6],hybrid:15,hylo:12,hylomorph:12,identifi:15,ift:2,iii:15,implement:15,indic:0,infer:[15,21],inferenc:15,inform:0,infra:[2,16],integ:5,interest:6,interlud:10,intern:18,interpret:[1,7,15],item:16,iter:[5,10],joi:[0,1,3,5,7,12,15,16,17,18,19,20,21],junk:[],just:5,kei:10,languag:0,least_fract:2,left:10,less:10,let:5,librari:[3,7,15],like:10,list:[2,20],literari:7,littl:5,logic:[2,15],loop:[2,7],lower:10,lshift:2,make:[6,8],mani:5,map:2,math:2,method:8,min:2,miscellan:2,mod:2,modifi:15,modulu:2,more:10,most:10,mul:[2,15],multipl:[5,6,15],must:10,name:11,neg:2,newton:8,next:8,node:10,non:10,now:10,nullari:2,number:[12,15],one:7,onli:7,order:[10,14],osdn:0,our:10,over:2,pack:5,pam:2,para:12,paradigm:15,parameter:[10,14],pars:[2,18],parser:[7,18],part:15,pass:7,path:16,pattern:12,per:10,poly_typ:[],polytyp:21,pop:[2,15],popd:2,popop:2,pow:2,power:6,pred:2,predic:[5,8,10,14],pretty_print:19,primit:12,primrec:2,print:7,problem:[5,6],process:10,product:2,program:[4,5,11,14,17],progress:15,project:[0,5,6],pure:7,put:[10,11,14],python:[7,13,15],quadrat:11,quick:0,quot:[2,20],rang:[2,5,12],range_to_zero:2,read:7,recur:[8,10],recurs:[10,12,14],redefin:[10,14],refactor:[5,10],refer:3,regular:7,reimplement:14,relabel:15,rem:2,remaind:2,remov:2,render:5,repl:7,replac:[10,13],repres:15,reset:6,rest:[2,15],revers:2,right:[10,16],rightmost:10,roll:[2,15],rolldown:2,rollup:2,rshift:2,rule:15,run:[2,6],second:[2,15],select:2,sequenc:[6,15,20],set:[8,10],shorter:13,should:7,shunt:2,simpl:15,simplest:5,size:[2,13],someth:[],sourc:10,special:[12,15],sqr:[2,15],sqrt:[2,11],stack:[2,7,15,20],start:0,step:[2,12,14],straightforward:11,structur:10,style:7,sub:[2,10],subtyp:15,succ:2,sum:[2,5],swaack:2,swap:[2,15],swon:2,swoncat:2,symbol:[7,12],tabl:0,tail:12,take:2,term:[5,6,14],ternari:2,text:18,than:10,them:11,thi:10,third:[2,15],three:6,thun:[0,7],time:[2,6],togeth:[10,11,14],token:7,toler:8,trace:[13,19],traceprint:7,travers:[10,14,16],treat:[10,14],tree:[10,14,16],treegrind:14,treestep:14,triangular:12,truediv:2,truthi:2,tuck:2,two:6,type:[15,21],unari:2,unbound:15,uncon:[2,15],unifi:15,unit:2,unnecessari:5,unquot:2,unstack:2,updat:[9,15],use:15,util:[19,20,21],valu:[6,10],variabl:11,variat:6,version:[5,10,13,15],view:7,vii:15,within:8,word:2,work:15,write:11,xor:2,yin:15,zero:6,zip:2,zipper:16}})
\ No newline at end of file
+Search.setIndex({docnames:["index","joy","lib","library","notebooks/Categorical","notebooks/Derivatives_of_Regular_Expressions","notebooks/Developing","notebooks/Generator_Programs","notebooks/Intro","notebooks/Newton-Raphson","notebooks/NoUpdates","notebooks/Ordered_Binary_Trees","notebooks/Quadratic","notebooks/Recursion_Combinators","notebooks/Replacing","notebooks/The_Four_Operations","notebooks/Treestep","notebooks/TypeChecking","notebooks/Types","notebooks/Zipper","notebooks/index","parser","pretty","stack","types"],envversion:52,filenames:["index.rst","joy.rst","lib.rst","library.rst","notebooks/Categorical.rst","notebooks/Derivatives_of_Regular_Expressions.rst","notebooks/Developing.rst","notebooks/Generator_Programs.rst","notebooks/Intro.rst","notebooks/Newton-Raphson.rst","notebooks/NoUpdates.rst","notebooks/Ordered_Binary_Trees.rst","notebooks/Quadratic.rst","notebooks/Recursion_Combinators.rst","notebooks/Replacing.rst","notebooks/The_Four_Operations.rst","notebooks/Treestep.rst","notebooks/TypeChecking.rst","notebooks/Types.rst","notebooks/Zipper.rst","notebooks/index.rst","parser.rst","pretty.rst","stack.rst","types.rst"],objects:{"joy.joy":{joy:[1,1,1,""],repl:[1,1,1,""],run:[1,1,1,""]},"joy.library":{"void":[3,1,1,""],BinaryBuiltinWrapper:[3,1,1,""],DefinitionWrapper:[3,2,1,""],FunctionWrapper:[3,1,1,""],SimpleFunctionWrapper:[3,1,1,""],UnaryBuiltinWrapper:[3,1,1,""],add_aliases:[3,1,1,""],app1:[3,1,1,""],app2:[3,1,1,""],app3:[3,1,1,""],b:[3,1,1,""],branch:[3,1,1,""],choice:[3,1,1,""],clear:[3,1,1,""],cmp_:[3,1,1,""],concat_:[3,1,1,""],cond:[3,1,1,""],dip:[3,1,1,""],dipd:[3,1,1,""],dipdd:[3,1,1,""],divmod_:[3,1,1,""],drop:[3,1,1,""],dupdip:[3,1,1,""],floor:[3,1,1,""],genrec:[3,1,1,""],getitem:[3,1,1,""],help_:[3,1,1,""],i:[3,1,1,""],id_:[3,1,1,""],infra:[3,1,1,""],initialize:[3,1,1,""],inscribe:[3,1,1,""],loop:[3,1,1,""],map_:[3,1,1,""],max_:[3,1,1,""],min_:[3,1,1,""],parse:[3,1,1,""],pm:[3,1,1,""],pred:[3,1,1,""],remove:[3,1,1,""],reverse:[3,1,1,""],select:[3,1,1,""],sharing:[3,1,1,""],shunt:[3,1,1,""],sort_:[3,1,1,""],sqrt:[3,1,1,""],step:[3,1,1,""],succ:[3,1,1,""],sum_:[3,1,1,""],take:[3,1,1,""],times:[3,1,1,""],unique:[3,1,1,""],unstack:[3,1,1,""],warranty:[3,1,1,""],words:[3,1,1,""],x:[3,1,1,""],zip_:[3,1,1,""]},"joy.library.DefinitionWrapper":{add_def:[3,3,1,""],add_definitions:[3,3,1,""],parse_definition:[3,3,1,""]},"joy.parser":{ParseError:[21,4,1,""],Symbol:[21,2,1,""],text_to_expression:[21,1,1,""]},"joy.utils":{generated_library:[3,0,0,"-"],polytypes:[24,0,0,"-"],pretty_print:[22,0,0,"-"],stack:[23,0,0,"-"],types:[24,0,0,"-"]},"joy.utils.generated_library":{ccons:[3,1,1,""],cons:[3,1,1,""],dup:[3,1,1,""],dupd:[3,1,1,""],dupdd:[3,1,1,""],first:[3,1,1,""],first_two:[3,1,1,""],fourth:[3,1,1,""],over:[3,1,1,""],pop:[3,1,1,""],popd:[3,1,1,""],popdd:[3,1,1,""],popop:[3,1,1,""],popopd:[3,1,1,""],popopdd:[3,1,1,""],rest:[3,1,1,""],rolldown:[3,1,1,""],rollup:[3,1,1,""],rrest:[3,1,1,""],second:[3,1,1,""],stack:[3,1,1,""],stuncons:[3,1,1,""],stununcons:[3,1,1,""],swaack:[3,1,1,""],swap:[3,1,1,""],swons:[3,1,1,""],third:[3,1,1,""],tuck:[3,1,1,""],uncons:[3,1,1,""],unit:[3,1,1,""],unswons:[3,1,1,""]},"joy.utils.polytypes":{CombinatorJoyType:[24,2,1,""],FUNCTIONS:[24,5,1,""],FunctionJoyType:[24,2,1,""],IntJoyType:[24,2,1,""],KleeneStar:[24,2,1,""],SymbolJoyType:[24,2,1,""],compose:[24,1,1,""],defs:[24,1,1,""],infer:[24,1,1,""],meta_compose:[24,1,1,""]},"joy.utils.polytypes.KleeneStar":{kind:[24,6,1,""]},"joy.utils.pretty_print":{TracePrinter:[22,2,1,""]},"joy.utils.pretty_print.TracePrinter":{go:[22,7,1,""],viewer:[22,7,1,""]},"joy.utils.stack":{concat:[23,1,1,""],expression_to_string:[23,1,1,""],iter_stack:[23,1,1,""],list_to_stack:[23,1,1,""],pick:[23,1,1,""],stack_to_string:[23,1,1,""]},"joy.utils.types":{AnyJoyType:[24,2,1,""],BooleanJoyType:[24,2,1,""],FloatJoyType:[24,2,1,""],IntJoyType:[24,2,1,""],JoyTypeError:[24,4,1,""],NumberJoyType:[24,2,1,""],StackJoyType:[24,2,1,""],compilable:[24,1,1,""],compile_:[24,1,1,""],compose:[24,1,1,""],defs:[24,1,1,""],delabel:[24,1,1,""],doc_from_stack_effect:[24,1,1,""],reify:[24,1,1,""],relabel:[24,1,1,""],unify:[24,1,1,""]},"joy.utils.types.BooleanJoyType":{accept:[24,6,1,""]},"joy.utils.types.FloatJoyType":{accept:[24,6,1,""]},"joy.utils.types.IntJoyType":{accept:[24,6,1,""]},"joy.utils.types.StackJoyType":{accept:[24,6,1,""]},joy:{joy:[1,0,0,"-"],library:[3,0,0,"-"],parser:[21,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"],"2":["py","class","Python class"],"3":["py","classmethod","Python class method"],"4":["py","exception","Python exception"],"5":["py","data","Python data"],"6":["py","attribute","Python attribute"],"7":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:function","2":"py:class","3":"py:classmethod","4":"py:exception","5":"py:data","6":"py:attribute","7":"py:method"},terms:{"05s":5,"0b11100111011011":6,"23rd":18,"4b4cb6ff86e5":[],"58a8e44e9cba":[],"5bkei":11,"5eb7ac5ad2c2":[],"7fde90b4e88f":[],"\u03b4":5,"\u03b5":9,"abstract":[8,11],"boolean":[2,3,8,11,15],"break":[5,8,18],"byte":[5,6],"case":[2,3,13,15,16,18,23],"char":5,"class":[3,5,8,18,21,22,23,24],"default":[3,7,11,23],"export":[3,21],"final":[2,11,13],"float":[3,8,18,19,21,24],"function":[0,1,4,6,7,10,12,17,19,20,21,22,23,24],"g\u00e9rard":19,"goto":5,"import":[2,5,6,7,9,11,12,13,14,16,17,18,19],"int":[5,7,8,13,18,19,21,23,24],"long":[11,18,20],"new":[2,3,5,7,8,10,13,14,18,24],"p\u00f6ial":20,"p\u00f6ial06typingtool":18,"public":10,"return":[1,3,5,6,8,11,13,14,15,16,18,21,22,23,24],"static":[2,10],"super":18,"switch":[2,18],"throw":[11,24],"true":[2,3,5,6,13,15,18,24],"try":[7,9,12,13,16,17,18],"void":[0,3],"while":[3,5,8,11,18,21,23],AND:[5,18],Adding:[8,14,20],And:[5,6,7,9,11,13,15,18,19,23],But:[0,4,6,7,8,11,14,18],CPS:8,FNs:[],For:[2,3,11,13,14,18,20,23,24],Has:[],Its:3,NOT:5,Not:18,One:[2,8,15,18,20],REs:5,TOS:[2,3],That:[6,11],The:[0,1,2,3,4,5,7,9,10,12,19,20,21,23,24],Then:[2,3,11,12,13,18],There:[5,12,13,15,16,18,23],These:[15,18,20,23,24],Use:[3,9,13],Used:15,Using:[0,9,11,20],With:[9,13,18,20,24],_1000:18,__add__:18,__builtin__:24,__call__:5,__class__:18,__eq__:18,__ge__:18,__hash__:18,__init__:[5,18],__main__:18,__name__:[],__radd__:18,__repr__:18,__str__:22,_and:5,_compaction_rul:5,_con:5,_dictionari:18,_ge:18,_infer:18,_interpret:18,_log:18,_log_it:18,_names_for:18,_or:5,_templat:5,_to_str:18,_tree_add_:11,_tree_add_e:[11,24],_tree_add_p:11,_tree_add_r:11,_tree_add_t:11,_tree_delete_:11,_tree_delete_clear_stuff:[11,24],_tree_delete_del:11,_tree_delete_r0:[11,24],_tree_delete_r1:11,_tree_delete_rightmost:11,_tree_delete_w:11,_tree_get_:[11,24],_tree_get_p:11,_tree_get_r:11,_tree_get_t:11,_tree_iter_order_curr:11,_tree_iter_order_left:11,_tree_iter_order_r:11,_tree_iter_order_right:11,_tree_t:11,_treestep_0:16,_treestep_1:16,_uniqu:18,_within_b:9,_within_p:9,_within_r:9,a10001:18,a10002:18,a10003:18,a10004:18,a1001:[],abbrevi:16,abil:[],abl:[5,15,18,24],about:[0,8,11,15,18,19,23,24],abov:[0,5,6,9,11,13,15,18],abs:9,absolut:8,accept:[1,2,3,5,6,7,8,11,12,14,15,16,18,19,24],accord:5,accordingli:[11,15],accumul:6,act:[5,24],action:[8,14,18,19],actual:[2,6,8,11,15,18],adapt:20,add:[3,5,6,7,8,14,18,22,24],add_alias:3,add_def:3,add_definit:[3,11,16],added:[4,11],adding:[10,18],addit:[0,2,3,6,8,13,14,16],address:20,adjust:[11,24],advantag:18,affect:15,after:[5,6,7,8,13,15,18,24],afterward:8,again:[2,3,6,8,11,13,18,24],against:[18,24],aggreg:19,ahead:18,aka:[5,8,19,24],albrecht:0,algorithm:[5,8,18],alia:[3,24],alias:[3,8],align:[8,22],all:[3,5,6,7,8,11,13,14,15,16,18,22,24],alloc:18,allow:[10,11,15],almost:11,along:[5,8,13,18,24],alphabet:3,alreadi:[5,9,14,18,19],also:[0,5,6,8,11,15,18,23,24],alter:[5,18],altern:[4,18,24],although:[4,11],altogeth:7,alwai:[6,10,13,15],amaz:[],amend:15,among:18,amort:11,analysi:[4,20],anamorph:[8,20],ani:[4,5,6,8,10,11,15,18,19,21,24],annual:8,anonym:11,anoth:[5,11,15,18,23,24],anyhow:[15,18],anyjoytyp:[18,24],anymor:18,anystarjoytyp:18,anyth:[2,3,5,8,18,24],apart:18,api:10,app1:3,app2:[3,8,12,13,14,15],app3:[3,15],app:8,appear:[2,4,5,6,11,24],append:18,appendix:20,appli:[2,3,6,7,11,13,18,24],applic:7,approach:6,appropri:5,approxim:20,archiv:0,aren:19,arg:[2,3],argument:[2,3,8,9,12,13,20,22,23],arithmet:2,ariti:[2,15],around:[6,18,23],arrang:16,arriv:[7,16],arrow:5,articl:[0,4,7,13],ascii:5,ascii_lowercas:5,ask:[4,7,18],aspect:0,assembl:5,assert:[5,18],assign:[15,23],associ:11,assum:9,astar:[],asterisk:16,asterix:[18,24],asyncron:15,attack:8,attempt:[0,1,18],attribut:3,attributeerror:18,author:18,auto:[0,18,24],automat:[4,15,18,24],auxiliari:[5,16],avail:[0,18,24],averag:[8,14],avoid:[11,24],awai:[11,18],awar:2,awkward:[11,13,18],azur:20,back:[11,18],backport:[],backtrack:24,backward:[10,11,12,16],bad:18,bag:8,banana:13,bar:15,barb:13,base:[0,2,3,10,13,16,18],basic:[1,2,3,8,11],basicconfig:[17,18],becaas:5,becaus:[2,3,5,8,11,15,16,18,19,23],becom:[11,16,23],becuas:18,been:[5,9,10,11,18,19],befor:[5,7,8,11],begin:[11,16],behavior:[10,16,24],behaviour:[0,1,18,24],behind:15,being:[0,15,24],below:[2,3,5,6,7,11,18,19],bespok:8,best:0,better:[6,11,13,18],between:[0,6,24],beyond:7,biannual:8,bin:5,binari:[0,7,8,20],binary_search_tre:11,binarybuiltinwrapp:3,bind:8,bingo:19,bit:[5,6,7,11,18],bliss:[0,20],block:6,bodi:[2,5,8,11,15],body_text:3,booktitl:18,bool:[13,18,24],booleanjoytyp:24,borrow:[8,18],both:[2,6,8,12,13,14,15,18,23],bottom:7,bounce_to:5,bracket:[8,18,21],branch:[3,5,6,7,13,18,24],branch_fals:18,branch_tru:18,breakpoint:8,bring:[6,8,18],broken:[],bruijn:18,brutal:15,brzozowski:18,brzozowskian:5,btree:[11,16],buck:11,bug:[0,8],build:[7,8,12,13,19,23],built:[12,18],bundl:[2,3,13],burgeon:8,calculu:4,call:[2,5,8,10,11,13,15,18,22,23],caller:[11,18],can:[0,2,3,4,5,6,7,8,9,10,12,13,14,15,16,18,19,20,23,24],cancel:15,cannot:[17,18],captur:[8,24],card:8,care:[6,23],carefulli:19,carri:[7,11,24],cartesian:4,catamorph:20,categor:[0,20],categori:[4,15],ccc:4,ccon:[3,11,17,18,24],cell:[13,18],certain:[8,23],certainli:11,chain:[3,15],chang:[2,10,11,18,19],charact:[5,19],chat:8,chatter:[0,18],check:[7,9,18],checker:[],child:16,choic:[3,13],choos:10,chop:12,chose:5,cinf:11,circl:5,circuit:4,cite_not:11,classmethod:3,claus:[3,18],clean:18,clear:[3,6,8,24],clear_stuff:11,cleav:[8,12,14],close:[0,1,4],clunki:[6,18],clv:15,cmp:[3,16,20],cmp_:3,code:[0,1,4,5,12,13,15,18,20,24],codireco:[7,9],collaps:13,collect:[4,5,7,8,18],collis:24,combin:[0,3,6,7,8,9,12,15,16,19,20,24],combinatorjoytyp:[18,24],combo:[],come:[8,11,18],command:[8,11,18],comment:[15,24],common:[2,6,15],compar:[3,4,5,18],comparison:[0,11],compat:15,compel:4,compil:[2,4,5,8,11,14,15,20,24],compile_:24,complement:5,complet:4,complex:[3,15,18,19,24],complic:18,compos:[5,24],composit:[18,24],compostit:18,compound:11,comput:[2,4,5,6,8,12,15,18,24],con:[3,5,6,7,8,9,11,12,13,15,16,19,23,24],conal:[4,15],concat:[3,7,8,15,16,18,23],concat_:[3,24],concaten:[0,5],concatin:[0,3,5,23],concern:15,conclus:20,concurr:2,cond:[3,11],condit:[3,8],confer:18,conflict:[11,18,24],conjectur:[],consecut:20,consid:[5,6,7,11,13,16,18,19],consist:[2,7,8,15,16],constant:11,constitu:13,constraint:[],construct:[15,18],consum:[15,18],contain:[0,2,3,5,7,8,13,18],content:18,context:2,conting:11,continu:[0,5,13,18,19],control:8,conveni:[4,15,18],convent:15,convers:18,convert:[13,14,16,18,21,23],cool:11,copi:[2,3,6,11,13,15,16,17,20],copyright:8,correct:[],correspond:[4,15],could:[2,4,5,6,8,10,11,15,18,19],couldn:15,count:[3,18],counter:[6,18],coupl:16,cours:[6,11,18],cover:18,cpu:15,crack:11,crap:[],crash:11,creat:[0,2,3,6,9,11,15,18],creativ:18,crude:[11,18,21,24],cruft:18,crunchi:[],curent:24,currect:[],current:[2,3,8,13,15,16,18,19,22,24],curri:5,custom:10,cycl:[6,7],cython:8,d010101:5,d0101:5,d01:5,d10:5,d_compact:5,dai:8,data:[2,3,5,13],datastructur:[0,2,13,18,20,21,23],datatyp:23,ddee30dbb1a6:[],ddididi:19,deal:[0,5,11,15],dealt:18,debugg:18,decid:11,declar:18,decor:3,decoupl:13,decrement:3,deduc:[6,18],deeper:0,deepli:4,def:[3,5,8,13,14,18,23,24],defaultdict:[5,18],defi:3,defin:[2,3,4,5,6,7,8,9,10,12,13,14,15,18,19,20],definit:[2,3,6,7,8,10,11,13,16,18,20,24],definitionwrapp:[3,11,13,16],defint:15,del:17,delabel:24,deleg:8,delet:20,deliber:18,demo:18,demonstr:4,depend:[3,11,13,15],deposit:16,depth:[18,24],dequot:13,der:11,deriv:[2,3,6,8,9,11,18,20],derv:5,describ:[3,4,5,11,13,15,16,18,21,24],descript:[6,8],descriptor:18,design:[2,3,11,15,20],desir:[8,16],destin:5,destruct:11,detail:[8,11,18],detect:[5,7,11,13,18],determin:20,develop:[0,7,8,18,20],diagram:6,dialect:1,dict:[1,3,5,18,24],dictionari:[0,1,3,8,18,20],did:18,differ:[0,4,6,9,11,12,13,15,23],differenti:4,difficult:18,difficulti:15,dig:[11,19],digit:6,digraph:5,dinfrirst:[8,18,24],dip:[3,6,7,8,9,11,12,13,14,15,16,18,20,24],dip_a:[],dip_t:[],dipd:[3,7,8,11,12,13,15,18,19,24],dipdd:[3,11,24],direco:20,direct:8,directli:[6,15,16,18,23],disappear:[2,5,18,24],discard:[3,7,9,11,13],disciplin:11,disenstacken:8,disk:8,displac:2,displai:18,distiguish:18,distribut:15,ditch:11,div:[3,8,18,24],dive:16,divis:11,divmod:[3,24],divmod_:[3,18],doc:[2,3,8,18,24],doc_from_stack_effect:[17,24],docstr:[18,24],document:[18,20,21,23],doe:[0,1,4,5,7,8,14,15,18,20,22,24],doesn:[6,10,11,15,16,18,23],doing:[4,6,8,15,18,19],domain:[4,18],don:[5,6,8,11,18,24],done:[2,6,8,10,18],dooooc:18,door:8,dot:[5,22],doubl:[5,6,8,18],doublecircl:5,down:[2,5,9,13,19,24],down_to_zero:8,dozen:8,draft:[4,10],dream:8,drive:[7,9],driven:6,driver:[5,7],drop:[3,11],dudipd:8,due:18,dup:[3,6,7,8,9,11,12,13,15,17,19,23,24],dupd:[3,18,24],dupdd:[3,24],dupdip:[3,6,11,12,13,24],duplic:[3,11,13],durat:2,dure:[2,13],each:[2,3,4,5,6,8,13,14,15,16,18,22,24],easi:[0,11,16,18,19],easier:[3,11,15],easili:4,eat:5,edit:20,effect:[2,3,5,8,15,19,20,24],effici:[7,14,19],efg:18,either:[1,2,3,5,11,13,18],elabor:18,eleg:[0,5,8,11,15,20],element:2,elif:18,elimin:[5,18],elliott:[4,15],els:[2,3,5,13,15,18],else_:18,embed:[4,11,19],emit:18,empti:[3,5,8,16,18,23,24],encapsul:8,enclos:8,encod:7,encount:18,end:[5,6,11,13,16,18,23],endless:7,enforc:[2,8],engend:8,enorm:[],enough:[5,8,13,22,24],enstacken:[7,8,18],enter:8,enter_guard:18,entir:23,entri:[3,19,22],enumer:18,ephasi:[],epsilon:9,equal:[6,16,23],equat:[8,9],equival:15,ergo:[5,11],err:[11,17],error:[8,18,21],essai:0,establish:18,etc:[3,16,18,19,21],euler:20,euro:18,eval:[0,18],evalu:[1,2,3,8,9,11,12,13,14,15,16,18],event:15,eventu:[15,18],ever:18,everi:[7,15],everybodi:15,everyth:[3,5,11,12,15,18],evolv:10,examin:13,exampl:[0,3,5,6,18,20,21,23,24],exce:7,except:[5,8,11,17,18,21,24],execut:[0,1,2,3,8,13,14,15,16,18,19,23,24],exend:18,exercis:[5,11],exist:[4,11,18],expand:11,expect:[2,3,15,16,18,23,24],experi:[8,16],explain:18,explan:8,explor:[8,18],express:[0,1,2,3,4,11,13,14,18,19,22,23],expression_to_str:[18,23],extend:18,extra:[6,7],extract:[11,12,20],extrem:8,extrememli:8,f1001:[],f_g:18,f_in:18,f_out:18,f_python:18,facet:0,facil:8,fact:21,factor:[2,6,8,11,18],factori:20,fail:[2,3,11,21],fairli:18,fake:5,fale:[],fall:18,fals:[2,3,5,6,13,15,18,24],falsei:18,far:[9,11,13,18,24],fascin:0,favorit:15,fear:[11,18],few:[6,8,9,12,15,18],fewer:[3,8],fg_in:18,fg_out:18,fib:7,fib_gen:7,fibonacci:20,figur:[2,3,11,13,18],filter:11,fin:6,find:[2,3,5,6,7,15,16,18,20],finder:9,fine:[0,5,6,11,18,24],finite_state_machin:5,first:[3,5,7,8,9,11,12,13,14,16,19,20,24],first_two:[3,11,24],fit:[6,8],five:[6,8,20],fix:[2,3,5,13,18,24],fixm:[5,18],flag:[15,18],flatten:[8,16,18],flesh:5,flexibl:20,floatjoytyp:[18,24],floatstarjoytyp:18,floor:3,floordiv:[6,24],flow:8,follow:[0,2,3,5,8,10,13,15,16,18,19,24],foo:[8,10,11,15,18],foo_ii:10,fork:15,form:[2,3,4,5,6,7,13,16,18,23],forman:8,format:[17,18,20,22],formula:[0,6,20],forth:[8,18],forum:0,forward:18,found:8,foundat:[],four:[2,3,6,7,8,11,20],fourteen:6,fourth:[2,3,11,13,24],fractal:8,fraction0:8,fraction:[2,8],frame:13,framework:8,free:[4,8,11],freeli:2,from:[0,1,2,3,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,23],from_:5,from_iter:[],front:[2,3,13],frozenset:5,fulin:15,full:6,fulli:[],fun:[5,20],func:18,functionjoytyp:[18,24],functionwrapp:3,functool:5,funtion:11,further:[9,18,20],futur:15,g_in:18,g_out:18,garbag:8,gari:11,gcd:8,gener:[0,2,4,13,15,18,20,23,24],generated_librari:3,genrec:[3,8,11,13,15,16,18],geometr:6,get:[2,4,5,6,7,8,12,13,18,20],getch:5,getitem:3,getrecursionlimit:23,getsourc:8,ghc:4,give:[4,6,11,13,16,18,23],given:[2,3,6,7,9,11,13,15,18,19,20],global:[17,18],glue:8,goe:24,going:[5,11,12,15,16,18,19],good:[6,11,18],grab:18,grammar:21,grand:8,graph:15,graphic:5,graphviz:5,great:[0,8,18,20],greater:23,grind:18,grok:[],group:0,grow:5,gsra:9,guard:[11,18,24],had:[5,6,19],haiku:8,half:[6,18,19],hallmark:15,hand:[5,8,14,18,20],handi:[9,18],handl:[11,18,23,24],happen:[8,18],happi:5,hard:[5,18,19],hardwar:4,has:[0,2,5,7,8,9,10,11,13,15,18,19,23],hasattr:18,hash:18,haskel:4,have:[2,3,5,6,7,8,9,10,13,14,15,18,19,20,23,24],haven:[],head:23,heh:18,help:[8,11,13,18],help_:3,helper:[3,5],herd:8,here:[5,6,7,11,16,18,19,24],hide:11,hierarchi:18,higher:[5,8,11,18],highli:8,hij:5,histori:[18,22,24],hit:5,hmm:[5,11],hoist:3,hold:[6,18],hood:11,hope:[0,6,8,20],hopefulli:13,host:20,how:[0,4,5,9,11,13,18,19,20],howev:[13,14,15,18],html:[2,3,7,12,13,20],http:11,huet:19,huge:11,hugh:[9,16],human:8,hybrid:24,hylomorph:20,hypothet:2,id_:3,idea:[4,6,8,18],ident:[3,5,13,18,24],if_not_empti:11,ift:[3,11,13,16,18,24],ignor:[3,11,18],iii:20,illustr:[5,13],imagin:[5,15,19],imap:18,imit:[5,16],immedi:[5,13],immut:[5,8,11],imper:13,implement:[0,1,2,3,4,8,10,11,13,14,15,20,24],implementaion:15,impli:[],implicit:8,improv:18,includ:[4,11,15,16,18,24],inclus:6,incom:23,incompat:10,incorpor:12,increas:6,increment:[3,4,6,10,15],index:[0,8,18,23],indexerror:23,indic:[15,16,18,24],ineffici:18,infer:[0,17],inferenc:24,info:[17,18],inform:[3,5,18,24],infra:[3,7,8,11,12,14,15,16,18,20,24],infrastructur:3,initi:[2,3,5,8,9,11,18],inlin:11,inner:18,inproceed:18,input:[1,9,15,17,18,24],input_:5,inscrib:3,insert:18,insight:13,inspect:8,inspect_stack:18,instal:0,instanc:[18,24],instanti:[4,22],instead:[5,6,7,11,13,18,19,23,24],instruct:5,integ:[2,3,8,13,16,18],integr:3,intend:[0,8],interact:[8,20],interest:[0,6,11,18,20],interfer:15,interlud:20,intermedi:13,intern:[0,18,22,23],interpret:[0,4,10,14,21,22,24],interrupt:8,intersect:5,interspers:15,interv:[4,6],intjoytyp:[18,24],introduc:[10,24],introduct:0,intstarjoytyp:18,intuit:18,invalid:24,invari:3,invent:18,involv:18,ipf:8,ipython:[],isinst:[5,18],isn:[5,11,19],issubclass:18,item:[2,3,8,11,13,15,16,18,20,23],iter:[1,3,5,8,13,15,16,18,20,23],iter_stack:[14,23],iteritem:[5,18],itertool:[5,18],its:[0,2,3,4,6,8,11,13,15,16,18,23],itself:[0,2,8,11,15,18,24],j05cmp:[2,3,13],jaanu:18,jmp:5,job:[15,20],john:[9,16],joi:[2,4,10,11,12,14,15,17],join:[5,18],joypi:[8,19],joytypeerror:[17,24],jump:5,jump_from:5,june:[],junk:18,jupyt:20,just:[0,2,3,5,7,8,10,11,13,15,16,18,19],juxtaposit:15,kav:[],keep:[5,11,12,15,18,19],kei:[5,16,20],kevin:0,key_n:11,keyerror:[5,11,18],kind:[2,4,8,11,13,16,18,24],kinda:18,kjs:[],kleen:[16,18,24],kleenestar:[18,24],kleffner:18,know:[6,11,18],knowledg:18,known:[4,15],kstar:5,l2s:[],l_kei:11,l_left:11,l_right:11,l_valu:11,label:[5,18],lambda:[4,5,18],languag:[4,5,8,10,11,14,18],larg:[5,18],larger:23,largest:3,last:[6,11,13,18],lastli:7,later:[5,8,16,18],law:2,lazi:18,lazili:9,lcm:6,lead:[5,8,18,24],leaf:11,lean:8,learn:0,least:[2,6,13,18,23],least_fract:8,leav:[6,15],left:[5,8,12,13,15,16,18,19,22,23,24],leftov:13,legend:5,len:[5,18],length:[3,6,23],lens:13,less:[6,7,8,13,18,23],let:[7,9,11,12,13,16,18,19],letter:18,level:[4,5,11,17,18],librari:[0,5,14],like:[2,3,5,6,8,15,16,18,20,21,24],limit:[18,24],line:[3,8,11,12,18,22,24],linear:23,link:[0,5,18],linux:0,list:[0,3,5,6,8,9,11,13,15,16,18,19,22,24],list_to_stack:[18,23],lit:[],liter:[1,11,16,18,19,21],literatur:18,littl:[5,7,11,15,18,20],live:20,lkei:16,load:[6,8],local:18,locat:2,locu:22,lof:[],log:[17,18],log_2:11,logic:[0,6,20],longer:[11,18],look:[5,7,8,9,11,12,15,18],lookup:8,loop:[0,1,3,5,6,18,24],lose:18,lot:[5,8,11,18,19],love:6,low:[4,5],lower:6,lowercas:[5,18],lowest:11,lshift:24,machin:0,machineri:[11,18,24],macro:8,made:[0,8,15,18,19],magic:18,mai:[2,13,15],mail:0,main:[0,3,8,12,15,18,19],mainloop:10,maintain:19,major:10,make:[2,3,4,6,8,11,13,14,15,16,18,19,20],make_gener:9,make_graph:5,manfr:[0,2,3,4,13],mani:[0,5,8,18],manipul:18,manner:12,map:[1,3,5,6,8,10,13,16,18],map_:3,marker:8,mask:[6,7],match:[0,1,18],materi:0,math:[0,8,9,11,12,18],mathemat:8,matter:[6,9,11,16],max_:3,maximum:3,mayb:[11,18],mean:[4,6,8,9,11,13,16,18,23,24],meant:[8,11,13,16],mem:5,member:[2,3,13],memo:5,mental:8,mention:2,mercuri:0,mess:18,messag:[17,18],meta:[8,11,14],meta_compos:[18,24],metal:[],method:[0,3,8,18,20,22],midpoint:6,might:[4,5,7,11,18],mike:11,million:7,min_:3,mind:18,minimum:3,minor:11,minu:3,mirror:0,miscellan:0,mismatch:18,mix:[8,18],mod:3,mode:18,model:[4,8],modern:0,modif:[7,18],modifi:[8,11,19],modul:[0,1,3,8,18,21],modulu:[8,24],moment:18,month:8,more:[0,3,4,5,6,7,8,9,13,14,15,16,18,21,23,24],most:[5,18,24],mostli:0,motiv:[],move:[5,11],movement:2,much:[5,6,7,11,13,18],muck:11,mul:[8,12,17,19,22,24],multi:3,multipl:[20,24],must:[2,3,6,10,13,15,16,18],myself:18,n10001:18,n10002:18,n10003:18,n1001:18,n1002:18,n1003:18,name:[1,3,5,8,10,11,13,18,19,20,21,23,24],narr:18,natur:[5,6,7,11,18],navig:19,nearli:18,neat:11,neato:18,necessarili:18,need:[2,3,6,7,9,10,11,13,15,18],neg:[3,12,24],neither:[15,18],ness:5,nest:[3,8,11,19],network:8,never:[5,10,13],new_def:18,new_f:18,new_fo:18,new_kei:11,new_valu:11,newton:[0,20],next:[5,6,15,16,18,24],nice:[0,5,13,23],niether:2,node:[5,16,20],node_kei:11,node_valu:11,non:[5,16,18,24],none:[1,3,18,24],nope:16,nor:5,normal:15,notat:[8,11],note:[2,5,6,9,11,13,15,18,23],notebook:[6,7,8,18,19,20],notebook_preambl:[2,6,7,9,11,12,13,14,16,18,19],noth:[2,11,15],notic:6,now:[5,6,7,8,13,14,16,18,20],nth:[3,23],nullari:[8,11,15,18,24],number:[1,2,3,6,7,9,15,23,24],numberjoytyp:[18,24],numberstarjoytyp:18,numer:18,object:[5,18,21],observ:6,obviou:7,obvious:18,occur:11,odd:[6,7],off:[2,3,6,7,12,18,19],often:[5,15],okai:[],old:[2,14],old_k:11,old_kei:11,old_valu:11,omg:5,omit:[13,18],onc:[3,5,10,11],one:[2,3,5,6,7,11,13,15,16,18,22,23,24],ones:[5,7,18],onli:[2,3,5,6,11,13,15,18,19,23,24],onto:[1,2,3,8,13,23],open:[8,18],oper:[3,5,8,11,13,23],oppos:18,optim:11,option:[1,8,11,18,23],orchestr:15,order:[0,2,3,8,13,15,17,18,20,23],org:[0,11],origin:[0,1,2,3,11,19],other:[0,2,3,4,5,8,11,13,16,18,23,24],otherwis:[3,5,6,7,11,16,18,24],our:[5,6,7,8,9,13,16,18],out:[2,3,4,6,7,8,9,11,12,13,15,18,19],outcom:16,outlin:5,output:[5,9,13,15,17,18,24],outsid:4,over:[3,4,6,7,8,9,11,12,15,16,18,20,24],overhaul:18,overview:18,own:[11,18],pace:[],pack:23,packag:[0,8],page:[0,11,18,23],pair:[2,3,6,7,11,18],palidrom:6,palindrom:6,pam:8,paper:[4,8,13,15,19],paradigm:20,parallel:2,paramet:[1,2,3,13,14,21,22,23],parameter:20,paramorph:13,parenthes:[11,23],pariti:7,pars:[0,3,5,8],parse_definit:3,parseerror:21,parser:[0,17,18],part:[2,3,9,13,16,20],partial:[5,18],particular:19,pass:[0,5,11,18,22,24],patch:5,path:[5,18,20],pattern:[5,6,15,16,20],pe1:[6,7],pe2:7,pearl:19,pend:[3,8,13,18,19,22],peopl:20,per:[8,16],perfectli:15,perform:[5,15,18],perhap:7,period:8,permit:[15,18,23],permut:18,persist:11,phase:2,phi:5,pick:[6,7,15,23],pickl:8,pictur:11,piec:13,pip:0,place:[3,6,8,18],plai:0,plu:3,plug:[7,13,16],point:[4,5,8,11,13,15],pointless:2,poly_typ:[],polytyp:[0,17,18],pool:15,pop:[3,5,6,7,8,11,13,14,16,17,23,24],popd:[3,8,9,11,14,15,18,24],popdd:[3,7,12,18,24],popop:[3,6,7,8,9,11,16,18,24],popopd:[3,24],popopdd:[3,24],posit:[3,6,8,13],possibilit:11,possibl:[11,16,18,20],post:8,poswrd:18,potenti:15,pow:24,power:[8,18],pprint:5,pragmat:6,preambl:9,preceed:15,precis:[0,1],pred:[3,18,24],predic:[2,3,5,7,13,15],prefix:[18,22],preliminari:5,present:18,preserv:[4,16],pretti:[9,11,12,15,16,18,22,23],pretty_print:0,previou:[8,15],primari:[],prime:9,primit:[2,3,18,20],primrec:[3,7,8,9,13],principl:[],print:[0,1,2,3,5,17,18,22,23,24],probabl:[7,8,11,18],problem:[8,18,20],proc_curr:11,proc_left:11,proc_right:11,proce:[6,24],process:[5,8,16,18,22],produc:[6,11,13,16,18],product:[5,7,8,17,18,24],program:[0,2,3,7,8,9,11,13,15,18,19,24],programm:[15,18],progress:15,project:20,prolog:18,promis:15,prompt:8,proper:[2,3,13,15,24],properti:0,provabl:[],proven:[],provid:[0,3,4,8,15,18,24],pun:[0,8],punctuat:18,pure:[0,5],puriti:8,purpos:8,push:[2,3,8,13,19,23],pushback:8,put:[1,2,7,8,15,18,20,23],pypi:0,python:[0,2,3,5,11,13,15,19,20,21,23,24],quadrat:[0,20],queri:[11,16],query_kei:16,queu:13,quit:[0,1,16],quot:[0,3,7,8,11,12,13,15,16,18,19,22,24],quotat:[2,3,13],quotient:3,r_kei:11,r_left:11,r_right:11,r_valu:11,rais:[5,11,18,21,23],rang:[5,8,18],range_revers:13,range_to_zero:8,ranger:13,ranger_revers:13,rankdir:5,raphson:9,rather:[6,8,13,16],ratio:8,reach:[5,6,7,13],read:[0,1,6,7,11,18,19],readabl:14,reader:[5,11],readi:18,real:11,realiz:[4,11],rearrang:[2,11,18],reason:[6,8,15,18],rebuild:[16,19],rec1:[2,3,13],rec2:[2,3,13],recent:[],recogn:21,recombin:15,record:[8,22],recur:[13,18],recurs:[0,2,3,5,7,8,9,15,18,20,23],recus:8,recycl:[],redefin:20,redistribut:[3,8],redo:5,reduc:[2,18],redund:23,refactor:[8,10],refer:[0,2],referenti:15,reflect:15,regard:15,regist:2,regular:[18,21],reifi:[17,24],reimplement:[15,20],relabel:24,relat:[5,18],releas:10,remain:[2,8,10,18],remaind:[3,9],rememb:5,remind:18,remov:[3,11,18,23],render:20,repeat:6,repeatedli:6,repetit:5,repl:[0,1],replac:[0,2,3,7,12,13,15,16,18,19,20,23],repositori:0,repr:[5,18],repres:[2,8,11,15,21,22,24],represent:[23,24],reprod:7,repurpos:18,requir:[15,18,23],res:18,research:18,resembl:8,resolut:15,resourc:15,respect:[5,6,15],rest:[3,6,7,8,11,13,19,20,23,24],rest_two:11,restat:[],restor:2,restrict:[],result:[1,2,3,5,6,11,12,13,15,16,18,19],resum:8,retain:[],retir:2,retri:8,reus:[11,18],revers:[3,6,7,13,18,19,23],revisit:18,rewrit:[3,8,18],rewritten:8,rich:[],rid:11,right:[7,8,12,16,18,20,22,23,24],rightest:11,rightmost:6,rigor:15,risk:18,rkei:16,rob:18,robot:[],roll:[3,9,11,16],roll_dn:18,roll_down:[],roll_up:[],rolldown:[3,17,18,24],rollup:[3,18,24],root:[3,9,12],round:18,row:5,rrest:[3,17,18,24],rshift:24,rule:[15,20],run:[0,1,3,6,8,9,11,12,13,15,16,18,19],runtim:15,runtimeerror:23,s1000:[],s1002:[],s10:[],s23:[],sai:[5,7,11,12,16,18],same:[2,4,6,11,15,18,23],sandwich:[2,3,13],save:[2,5,6,8],scan:3,scanner:[8,21],scenario:19,scope:[7,11],search:[0,11],sec:[18,24],second:[3,8,11,13,16,23,24],section:13,see:[0,5,7,8,9,10,12,13,14,18,19,22],seem:[0,6,8,16,18,24],seen:[18,19,24],select:3,self:[5,15,18],semant:[2,3,8,10,11,15,18],semi:8,send:8,sens:[0,2,6,18,19],separ:[8,15,18],seq:18,sequenc:[0,1,2,3,6,8,11,13,14,19,20,21,24],sequence_to_stack:18,seri:[6,7,11,19],ses:18,set:[2,3,5,13,18,20],seven:[6,7],sever:[0,4,8,13],shape:[5,15],share:[3,8],shelf:2,shew:5,shift:[6,7],shorter:20,shorthand:11,should:[2,3,5,6,11,13,15,18],shouldn:8,show:[4,15,18,19],shunt:[3,19],side:[5,11,17,18,24],signatur:24,signifi:[8,11],similar:[11,16,18],simon:8,simpl:[5,8,13,23,24],simplefunctionwrapp:[3,14,18],simpler:16,simplest:[18,20],simpli:4,simplifi:[6,11,19],sinc:[2,6,11,18],singl:[3,7,8,14,15,18,21,24],singleton:5,situ:11,situat:11,six:[6,7,8],sixti:[6,7],size:[5,8,20],skeptic:8,skip:18,slight:9,slightli:[11,13,18],smallest:3,smart:11,softwar:8,solei:2,solut:[6,7],solvabl:8,some:[2,3,5,7,8,11,13,15,16,18,20,23,24],somehow:[11,18],someth:[2,10,11,18],sometim:11,somewher:[11,20],sort:[3,5,11,15,18],sort_:3,sorta:[],sourc:[0,1,3,18,20,21,22,23,24],space:[6,22],span:6,spawn:18,special:[7,11,20],specif:[0,4],specifi:[11,15,24],speed:14,spell:[5,16],sphinx:[20,23,24],spirit:[0,1,16],split:[5,18,24],sqr:[8,9,12,19],sqrt:[3,9,18,24],squar:[3,9,18,21],squishi:[],stack:[0,1,3,6,7,9,11,12,13,14,15,16,17,19,20,21,22,24],stack_concat:[],stack_effect:18,stack_effect_com:18,stack_to_str:[17,23],stacki:18,stackjoytyp:[18,24],stackstarjoytyp:18,stage:16,stai:[0,1],stand:[4,5,24],standard:[8,11],star:[16,18,24],stare:11,start:[5,6,7,8,9,11,13,16,18,24],state:8,state_nam:5,statement:[3,5],stdout:[17,18],step:[3,6,8,11,14,18,19,20],still:[5,11,18],stop:11,stopiter:5,storag:[6,11],store:[6,13,18],stori:13,str:[1,5,18,21,22,23],straightforward:[1,5,7,9,18,20],stream:[6,17,18],stretch:11,string:[1,2,3,8,18,19,21,22,23,24],stringi:5,strip:[],structur:[8,15,16,18,19,20,23],stuck:5,studi:5,stuff:[11,18],stuncon:[3,24],stununcon:[3,24],style:[0,4,18],sub:[10,15,24],subclass:8,subject:[15,19],subsequ:15,subset:[18,24],substitut:[5,11,18,24],subtract:6,subtyp:20,succ:[3,18,24],succe:18,success:9,suck:18,suffic:18,suffici:11,suffix:18,suggest:[4,5,11],suitabl:[3,4,6],sum:[3,7,8,12,13,14,16,24],sum_:[3,18],summand:6,sumtre:16,suppli:[11,21],support:[8,18,22,23],sure:15,suspect:2,svg:5,swaack:[3,12,14,18,19,24],swap:[3,6,7,8,9,11,13,14,15,16,17,19,24],swarm:[],swon:[3,7,8,13,16,18,19,24],swoncat:[7,8,9,13,16],swuncon:13,sym:5,symbol:[2,3,5,15,18,19,20,21],symboljoytyp:[18,24],symmetr:[6,11],symmetri:5,syntact:8,syntax:[8,23],sys:[17,18,23],system:[8,11,15],tabl:[5,18],tag:[5,18],tail:[11,18,20,23],take:[3,5,6,8,9,11,13,15,18,23],talk:[8,11,18,23],target:19,tast:4,tbd:8,tear:13,technic:2,techniqu:[4,19],technolog:2,temporari:19,ten:6,term:[1,2,5,8,9,13,15,18,20,21,23,24],termin:[2,3,5,13],ternari:8,test:[2,3,13],text:[0,1,3,18],text_to_express:[8,17,21],textual:8,than:[0,3,5,6,7,8,9,13,15,16,18,23,24],thei:[2,5,6,7,8,11,13,15,18,19,21,23,24],them:[2,3,5,6,7,11,13,15,18,19,20,24],themselv:[15,18,24],theori:[2,3,13,15],therefor:7,thi:[0,1,2,3,4,5,6,7,8,9,12,13,15,16,18,19,20,21,22,23,24],thing:[2,7,11,13,15,18,19,21,23,24],think:[2,6,8,11,13,15,16,18],third:[3,7,8,11,24],thirti:6,those:[2,3,5,11,13,18,20,24],though:[6,15],thought:[8,15],thousand:6,thread:[2,15],three:[2,3,5,6,8,11,12,16,18,20],through:[1,6,8,16,18,19,23,24],thun:[2,3,4,10,13,15],thunder:8,thunk:15,time:[3,5,6,8,9,11,13,15,18,19],titl:18,to_check:5,to_set:11,todai:8,todo:[8,21],togeth:[7,8,15,18,20],token:21,toler:20,too:[5,13,18],tool:[8,18],tooo:18,top:[2,3,8,13,18,22,23],total:6,tower:18,trace:[0,8,12,13,19,20,23],traceback:[],traceprint:22,track:[12,18,19],tracker:0,transform:4,transit:5,translat:[4,12,18],trap:5,trash:[],travers:[0,20],treasur:0,treat:[0,2,3,13,18,20],treatment:7,tree:[0,8,20],treegrind:20,treestep:[0,20],tri:6,triangl:15,triangular_numb:13,trick:[6,18],tricki:18,trobe:0,trove:0,truediv:24,truli:[],trust:[],truthi:[3,8,15,18],tuck:[3,8,18,24],tupl:[3,5,8,18,23,24],ture:[],turn:[2,3,5,18,24],twice:[11,13],two:[2,3,6,8,9,11,12,13,15,16,17,18,19,20,23,24],type:[0,1,4,8,11,13,15,20,21,22,23],typeerror:18,typeless:18,typic:[2,3,12,13],unari:8,unarybuiltinwrapp:3,unbalanc:[11,21],unbound:24,unchang:11,uncompil:18,uncon:[3,7,8,11,13,16,19,24],under:[2,3,8,11],underli:[5,15,18],underscor:18,understand:[0,11],undistinguish:11,undocu:8,unend:[],unfinish:5,unfortun:23,unicod:18,unif:18,unifi:[17,24],union:5,uniqu:[3,5,11,18],unit:[3,8,13,15,24],univers:[0,8,15,18,24],unlik:15,unnecessari:20,unnecesssari:18,unpack:[2,3,11,23],unpair:6,unquot:[8,16],unrol:5,unstack:[3,18],unswon:[3,24],untangl:13,until:[5,7,15],unus:6,unusu:11,unwrap:5,updat:[0,17,20,24],uppercas:5,upward:15,usag:8,use:[0,2,3,4,5,6,7,8,9,10,11,12,13,14,16,19,20,23],used:[3,4,8,11,13,15,18,19,21,23,24],useful:[0,15,18],user:16,uses:[2,5,6,13],using:[7,11,12,13,16,19,24],usual:[0,2,13],util:[0,3,14,17,18],valid:18,valu:[0,2,3,6,8,9,12,13,14,15,16,18,20,23,24],value_n:11,valueerror:[5,18,23],variabl:[18,20,24],variant:11,variat:[13,15,20],varieti:[4,8],variou:0,vener:23,verbos:4,veri:[0,1,4,5,8,11,23],verifi:[],versa:[2,18],version:[0,1,2,5,7,10,16,19,20],via:8,vice:[2,18],view:[11,20],viewer:[1,8,10,22],vii:20,visibl:18,von:[0,2,3,4,13],waaaai:5,wai:[0,2,3,4,5,6,8,13,14,15,18],wait:15,want:[2,6,7,9,11,13,18],warranti:[3,8],wash:8,wast:8,web:23,websit:[0,6],welcom:8,well:[0,4,8,9,11,18,21],went:18,were:[8,18,19],what:[2,3,4,5,8,11,13,15,16,18,22],whatev:[2,3,13,16,23],when:[6,7,8,11,13,15,18,19,21,23,24],where:[2,3,5,8,11,13,18,20,23],whether:13,which:[0,1,5,6,8,9,11,13,15,16,18,19,23,24],whole:[2,3,6,13,16,18],whose:7,why:[9,15,16],wiki:11,wikipedia:[0,11,19],wildli:8,wind:8,wire:13,within:[8,11,14,20],without:[2,8,11,12,15,18],won:[11,18,23],word:[0,3,6,8,13,19],work:[0,3,5,6,7,8,9,11,12,13,15,16,19,23,24],worker:15,worri:15,worth:6,would:[2,6,7,8,9,11,13,15,18,19,23,24],wrap:[3,8],wrapper:18,write:[4,5,9,11,13,15,16,18,19,20,23],written:[0,1,9,11,14,18,23],wrong:2,wrote:18,xrang:18,yang:18,yeah:15,year:[8,18],yet:[11,15,18,19],yield:[2,3,13,18,23,24],yin:20,you:[0,2,3,5,6,7,8,10,11,12,13,14,15,16,18,19,22,23],your:[2,3,8,13,18],yourself:[5,8,11],zero:[3,5,11,13,15,16,18,21,23,24],zip:[5,6,18],zip_:3,zipper:[0,20],zstr:19},titles:["Thun 0.2.0 Documentation","Joy Interpreter","Functions Grouped by, er, Function with Examples","Function Reference","Categorical Programming","\u2202RE","Developing a Program in Joy","Using <code class=\"docutils literal notranslate\"><span class=\"pre\">x</span></code> to Generate Values","Thun: Joy in Python","Newton\u2019s method","No Updates","Treating Trees I: Ordered Binary Trees","Quadratic formula","Recursion Combinators","Replacing Functions in the Dictionary","The Four Fundamental Operations of Definite Action","Treating Trees II: <code class=\"docutils literal notranslate\"><span class=\"pre\">treestep</span></code>","Type Checking","The Blissful Elegance of Typing Joy","Traversing Datastructures with Zippers","Essays about Programming in Joy","Parsing Text into Joy Expressions","Tracing Joy Execution","Stack or Quote or Sequence or List\u2026","Type Inference of Joy Expressions"],titleterms:{"\u03bb":5,"\u03d5":5,"abstract":[],"case":[9,11],"function":[2,3,5,8,9,11,13,14,15,16,18],"long":14,"new":11,"p\u00f6ial":18,"try":5,"void":2,"while":[2,15],Adding:11,One:[7,11],The:[6,8,11,13,15,16,18],There:8,Using:7,With:[5,16],about:20,action:15,add:[2,11],adding:11,address:19,alphabet:5,altern:16,ana:13,analysi:6,anamorph:[2,13],app1:2,app2:2,app3:2,appendix:[11,13,18],appli:15,approxim:9,argument:18,auto:3,averag:2,base:[9,11],binari:[2,11,16],bliss:18,both:11,branch:[2,11,15],brzozowski:5,can:11,cata:13,catamorph:13,categor:4,chatter:2,check:17,child:11,choic:2,clear:2,cleav:[2,15],cmp:11,code:[8,11],combin:[2,11,13,18],comment:18,compact:5,compar:11,comparison:2,compil:[7,18],compile_:18,compos:18,comput:9,con:[2,18],concat:2,conclus:[13,18],consecut:9,continu:8,current:11,datastructur:[5,8,11,19],deal:18,defin:[11,16],definit:[12,15],delabel:18,delet:11,deriv:[5,12,13,16],design:13,determin:19,develop:6,diagram:5,dialect:0,dictionari:14,dip:[2,19],dipd:2,dipdd:2,direco:7,disenstacken:2,distinguish:18,div:2,doc_from_stack_effect:18,document:0,doe:11,down_to_zero:2,drive:5,drop:2,dup:[2,18],dupd:2,dupdip:2,effect:18,eleg:18,els:11,empti:11,enstacken:2,equal:11,essai:20,euler:[6,7],eval:8,even:7,exampl:[2,8,11,13,16,17],execut:22,explor:5,express:[5,8,21,24],extract:16,factori:13,fail:17,fibonacci:7,filter:6,find:[9,11,13],finish:15,finit:5,first:[2,6,15,18],five:7,flatten:2,flexibl:16,floordiv:2,formula:12,found:11,four:[13,15],fsm:5,fulmin:15,fun:13,fundament:15,further:6,gcd:2,gener:[3,5,6,7,9],genrec:2,get:[11,16],getitem:2,given:16,greater:11,group:2,handl:15,have:[11,16],help:2,highest:11,host:0,how:[6,7],hybrid:18,hylo:13,hylomorph:13,identifi:18,ift:[2,15],iii:18,implement:[5,18],indic:0,infer:[18,24],inferenc:18,inform:0,infra:[2,19],integ:6,interest:7,interlud:11,intern:21,interpret:[1,8,18],item:19,iter:[6,11],joi:[0,1,3,6,8,13,18,19,20,21,22,23,24],join:15,junk:[],just:6,kei:11,kind:15,languag:0,larger:5,least_fract:2,left:11,less:11,let:[5,6],letter:5,librari:[3,8,18],like:11,list:[2,23],literari:8,littl:6,logic:[2,18],loop:[2,8,15],lower:11,lshift:2,machin:5,make:[7,9],mani:6,map:[2,15],match:5,math:2,memoiz:5,method:9,min:2,miscellan:2,mod:2,modifi:18,modulu:2,more:11,most:11,mul:[2,18],multipl:[6,7,18],must:11,name:12,neg:2,newton:9,next:9,node:11,non:11,now:11,nullari:2,nulli:5,number:[13,18],one:8,onli:8,oper:15,order:[11,16],osdn:0,other:15,our:11,out:5,over:2,pack:6,pam:[2,15],para:13,paradigm:18,parallel:15,parameter:[11,16],pars:[2,21],parser:[8,21],part:18,pass:8,path:19,pattern:13,per:11,poly_typ:[],polytyp:24,pop:[2,18],popd:2,popop:2,pow:2,power:7,pred:2,predic:[6,9,11,16],pretty_print:22,primit:13,primrec:2,print:8,problem:[6,7],process:11,product:2,program:[4,6,12,16,20],progress:18,project:[0,6,7],pure:8,put:[11,12,16],python:[8,14,18],quadrat:12,quick:0,quot:[2,23],rang:[2,6,13],range_to_zero:2,read:8,recur:[9,11],recurs:[11,13,16],redefin:[11,16],refactor:[6,11],refer:3,regular:[5,8],reimplement:16,relabel:18,rem:2,remaind:2,remov:2,render:6,repl:8,replac:[11,14],repres:[5,18],represent:5,reset:7,rest:[2,18],revers:[2,5,17],right:[11,19],rightmost:11,roll:[2,18],rolldown:2,rollup:2,rshift:2,rule:[5,18],run:[2,7],second:[2,18],select:2,sequenc:[7,15,18,23],set:[9,11],shorter:14,should:8,shunt:2,simpl:18,simplest:6,size:[2,14],someth:[],sourc:11,special:[13,18],sqr:[2,18],sqrt:[2,12],stack:[2,8,18,23],start:0,state:5,step:[2,13,16],straightforward:12,stream:5,string:5,structur:11,style:8,sub:[2,11],subtyp:18,succ:2,sum:[2,6],swaack:2,swap:[2,18],swon:2,swoncat:2,symbol:[8,13],tabl:0,tail:13,take:2,term:[6,7,16],ternari:2,text:21,than:11,them:12,thi:11,third:[2,18],three:7,thun:[0,8],time:[2,7],togeth:[11,12,16],token:8,toler:9,trace:[14,22],traceprint:8,trampolin:5,travers:[11,16,19],treat:[11,16],tree:[11,16,19],treegrind:16,treestep:16,triangular:13,truediv:2,truthi:2,tuck:2,two:[5,7],type:[17,18,24],unari:2,unbound:18,uncon:[2,18],unif:17,unifi:18,unit:2,unnecessari:6,unquot:2,unstack:2,updat:[10,18],use:18,util:[22,23,24],valu:[7,11],variabl:12,variat:7,version:[6,11,14,18],view:8,vii:18,within:9,word:2,work:[17,18],write:12,xor:2,yin:18,zero:7,zip:2,zipper:19}})
\ No newline at end of file
index e513362..e65bec7 100644 (file)
@@ -278,17 +278,6 @@ we can capture more information about the type signatures of some functions,
 and we can introduce a kind of Kleene Star or sequence type that can stand for
 an unbounded sequence of other types.</p>
 <dl class="class">
-<dt id="joy.utils.polytypes.AnyStarJoyType">
-<em class="property">class </em><code class="descclassname">joy.utils.polytypes.</code><code class="descname">AnyStarJoyType</code><span class="sig-paren">(</span><em>number</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/polytypes.html#AnyStarJoyType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.polytypes.AnyStarJoyType" title="Permalink to this definition">¶</a></dt>
-<dd><dl class="attribute">
-<dt id="joy.utils.polytypes.AnyStarJoyType.kind">
-<code class="descname">kind</code><a class="headerlink" href="#joy.utils.polytypes.AnyStarJoyType.kind" title="Permalink to this definition">¶</a></dt>
-<dd><p>alias of <a class="reference internal" href="#joy.utils.types.AnyJoyType" title="joy.utils.types.AnyJoyType"><code class="xref py py-class docutils literal notranslate"><span class="pre">joy.utils.types.AnyJoyType</span></code></a></p>
-</dd></dl>
-
-</dd></dl>
-
-<dl class="class">
 <dt id="joy.utils.polytypes.CombinatorJoyType">
 <em class="property">class </em><code class="descclassname">joy.utils.polytypes.</code><code class="descname">CombinatorJoyType</code><span class="sig-paren">(</span><em>name</em>, <em>sec</em>, <em>number</em>, <em>expect=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/polytypes.html#CombinatorJoyType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.polytypes.CombinatorJoyType" title="Permalink to this definition">¶</a></dt>
 <dd><p>Represent combinators.</p>
@@ -324,8 +313,8 @@ guard against being used on invalid types.</p>
 <div>A*</div></blockquote>
 <p>The <cite>A*</cite> works by splitting the universe into two alternate histories:</p>
 <blockquote>
-<div><p>A* -&gt; 0</p>
-<p>A* -&gt; A A*</p>
+<div><p>A* → ∅</p>
+<p>A*  A A*</p>
 </div></blockquote>
 <p>The Kleene star variable disappears in one universe, and in the other
 it turns into an <cite>AnyJoyType</cite> variable followed by itself again.</p>
@@ -340,28 +329,6 @@ dicts, the “unifiers”) that don’t lead to type conflicts.</p>
 </dd></dl>
 
 <dl class="class">
-<dt id="joy.utils.polytypes.NumberStarJoyType">
-<em class="property">class </em><code class="descclassname">joy.utils.polytypes.</code><code class="descname">NumberStarJoyType</code><span class="sig-paren">(</span><em>number</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/polytypes.html#NumberStarJoyType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.polytypes.NumberStarJoyType" title="Permalink to this definition">¶</a></dt>
-<dd><dl class="attribute">
-<dt id="joy.utils.polytypes.NumberStarJoyType.kind">
-<code class="descname">kind</code><a class="headerlink" href="#joy.utils.polytypes.NumberStarJoyType.kind" title="Permalink to this definition">¶</a></dt>
-<dd><p>alias of <a class="reference internal" href="#joy.utils.types.NumberJoyType" title="joy.utils.types.NumberJoyType"><code class="xref py py-class docutils literal notranslate"><span class="pre">joy.utils.types.NumberJoyType</span></code></a></p>
-</dd></dl>
-
-</dd></dl>
-
-<dl class="class">
-<dt id="joy.utils.polytypes.StackStarJoyType">
-<em class="property">class </em><code class="descclassname">joy.utils.polytypes.</code><code class="descname">StackStarJoyType</code><span class="sig-paren">(</span><em>number</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/polytypes.html#StackStarJoyType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.polytypes.StackStarJoyType" title="Permalink to this definition">¶</a></dt>
-<dd><dl class="attribute">
-<dt id="joy.utils.polytypes.StackStarJoyType.kind">
-<code class="descname">kind</code><a class="headerlink" href="#joy.utils.polytypes.StackStarJoyType.kind" title="Permalink to this definition">¶</a></dt>
-<dd><p>alias of <a class="reference internal" href="#joy.utils.types.StackJoyType" title="joy.utils.types.StackJoyType"><code class="xref py py-class docutils literal notranslate"><span class="pre">joy.utils.types.StackJoyType</span></code></a></p>
-</dd></dl>
-
-</dd></dl>
-
-<dl class="class">
 <dt id="joy.utils.polytypes.SymbolJoyType">
 <em class="property">class </em><code class="descclassname">joy.utils.polytypes.</code><code class="descname">SymbolJoyType</code><span class="sig-paren">(</span><em>name</em>, <em>sec</em>, <em>number</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/polytypes.html#SymbolJoyType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.polytypes.SymbolJoyType" title="Permalink to this definition">¶</a></dt>
 <dd><p>Represent non-combinator functions.</p>
diff --git a/docs/sphinx_docs/notebooks/Derivatives_of_Regular_Expressions.rst b/docs/sphinx_docs/notebooks/Derivatives_of_Regular_Expressions.rst
new file mode 100644 (file)
index 0000000..da66e21
--- /dev/null
@@ -0,0 +1,949 @@
+
+∂RE
+===
+
+Brzozowski's Derivatives of Regular Expressions
+-----------------------------------------------
+
+Legend:
+
+::
+
+    ∧ intersection
+    ∨ union
+    ∘ concatenation (see below)
+    ¬ complement
+    ϕ empty set (aka ∅)
+    λ singleton set containing just the empty string
+    I set of all letters in alphabet
+
+Derivative of a set ``R`` of strings and a string ``a``:
+
+::
+
+    ∂a(R)
+
+    ∂a(a) → λ
+    ∂a(λ) → ϕ
+    ∂a(ϕ) → ϕ
+    ∂a(¬a) → ϕ
+    ∂a(R*) → ∂a(R)∘R*
+    ∂a(¬R) → ¬∂a(R)
+    ∂a(R∘S) → ∂a(R)∘S ∨ δ(R)∘∂a(S)
+    ∂a(R ∧ S) → ∂a(R) ∧ ∂a(S)
+    ∂a(R ∨ S) → ∂a(R) ∨ ∂a(S)
+
+    ∂ab(R) = ∂b(∂a(R))
+
+Auxiliary predicate function ``δ`` (I call it ``nully``) returns either
+``λ`` if ``λ ⊆ R`` or ``ϕ`` otherwise:
+
+::
+
+    δ(a) → ϕ
+    δ(λ) → λ
+    δ(ϕ) → ϕ
+    δ(R*) → λ
+    δ(¬R) δ(R)≟ϕ → λ
+    δ(¬R) δ(R)≟λ → ϕ
+    δ(R∘S) → δ(R) ∧ δ(S)
+    δ(R ∧ S) → δ(R) ∧ δ(S)
+    δ(R ∨ S) → δ(R) ∨ δ(S)
+
+Some rules we will use later for "compaction":
+
+::
+
+    R ∧ ϕ = ϕ ∧ R = ϕ
+
+    R ∧ I = I ∧ R = R
+
+    R ∨ ϕ = ϕ ∨ R = R
+
+    R ∨ I = I ∨ R = I
+
+    R∘ϕ = ϕ∘R = ϕ
+
+    R∘λ = λ∘R = R
+
+Concatination of sets: for two sets A and B the set A∘B is defined as:
+
+{a∘b for a in A for b in B}
+
+E.g.:
+
+{'a', 'b'}∘{'c', 'd'} → {'ac', 'ad', 'bc', 'bd'}
+
+Implementation
+--------------
+
+.. code:: ipython2
+
+    from functools import partial as curry
+    from itertools import product
+
+``ϕ`` and ``λ``
+~~~~~~~~~~~~~~~
+
+The empty set and the set of just the empty string.
+
+.. code:: ipython2
+
+    phi = frozenset()   # ϕ
+    y = frozenset({''}) # λ
+
+Two-letter Alphabet
+~~~~~~~~~~~~~~~~~~~
+
+I'm only going to use two symbols (at first) becaase this is enough to
+illustrate the algorithm and because you can represent any other
+alphabet with two symbols (if you had to.)
+
+I chose the names ``O`` and ``l`` (uppercase "o" and lowercase "L") to
+look like ``0`` and ``1`` (zero and one) respectively.
+
+.. code:: ipython2
+
+    syms = O, l = frozenset({'0'}), frozenset({'1'})
+
+Representing Regular Expressions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To represent REs in Python I'm going to use tagged tuples. A *regular
+expression* is one of:
+
+::
+
+    O
+    l
+    (KSTAR, R)
+    (NOT, R)
+    (AND, R, S)
+    (CONS, R, S)
+    (OR, R, S)
+
+Where ``R`` and ``S`` stand for *regular expressions*.
+
+.. code:: ipython2
+
+    AND, CONS, KSTAR, NOT, OR = 'and cons * not or'.split()  # Tags are just strings.
+
+Because they are formed of ``frozenset``, ``tuple`` and ``str`` objects
+only, these datastructures are immutable.
+
+String Representation of RE Datastructures
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code:: ipython2
+
+    def stringy(re):
+        '''
+        Return a nice string repr for a regular expression datastructure.
+        '''
+        if re == I: return '.'
+        if re in syms: return next(iter(re))
+        if re == y: return '^'
+        if re == phi: return 'X'
+    
+        assert isinstance(re, tuple), repr(re)
+        tag = re[0]
+    
+        if tag == KSTAR:
+            body = stringy(re[1])
+            if not body: return body
+            if len(body) > 1: return '(' + body + ")*"
+            return body + '*'
+    
+        if tag == NOT:
+            body = stringy(re[1])
+            if not body: return body
+            if len(body) > 1: return '(' + body + ")'"
+            return body + "'"
+    
+        r, s = stringy(re[1]), stringy(re[2])
+        if tag == CONS: return r + s
+        if tag == OR:   return '%s | %s' % (r, s)
+        if tag == AND:  return '(%s) & (%s)' % (r, s)
+    
+        raise ValueError
+
+``I``
+~~~~~
+
+Match anything. Often spelled "."
+
+::
+
+    I = (0|1)*
+
+.. code:: ipython2
+
+    I = (KSTAR, (OR, O, l))
+
+.. code:: ipython2
+
+    print stringy(I)
+
+
+.. parsed-literal::
+
+    .
+
+
+``(.111.) & (.01 + 11*)'``
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The example expression from Brzozowski:
+
+::
+
+    (.111.) & (.01 + 11*)'
+       a    &  (b  +  c)'
+
+Note that it contains one of everything.
+
+.. code:: ipython2
+
+    a = (CONS, I, (CONS, l, (CONS, l, (CONS, l, I))))
+    b = (CONS, I, (CONS, O, l))
+    c = (CONS, l, (KSTAR, l))
+    it = (AND, a, (NOT, (OR, b, c)))
+
+.. code:: ipython2
+
+    print stringy(it)
+
+
+.. parsed-literal::
+
+    (.111.) & ((.01 | 11*)')
+
+
+``nully()``
+~~~~~~~~~~~
+
+Let's get that auxiliary predicate function ``δ`` out of the way.
+
+.. code:: ipython2
+
+    def nully(R):
+        '''
+        δ - Return λ if λ ⊆ R otherwise ϕ.
+        '''
+    
+        # δ(a) → ϕ
+        # δ(ϕ) → ϕ
+        if R in syms or R == phi:
+            return phi
+    
+        # δ(λ) → λ
+        if R == y:
+            return y
+    
+        tag = R[0]
+    
+        # δ(R*) → λ
+        if tag == KSTAR:
+            return y
+    
+        # δ(¬R) δ(R)≟ϕ → λ
+        # δ(¬R) δ(R)≟λ → ϕ
+        if tag == NOT:
+            return phi if nully(R[1]) else y
+    
+        # δ(R∘S) → δ(R) ∧ δ(S)
+        # δ(R ∧ S) → δ(R) ∧ δ(S)
+        # δ(R ∨ S) → δ(R) ∨ δ(S)
+        r, s = nully(R[1]), nully(R[2])
+        return r & s if tag in {AND, CONS} else r | s
+
+No "Compaction"
+~~~~~~~~~~~~~~~
+
+This is the straightforward version with no "compaction". It works fine,
+but does waaaay too much work because the expressions grow each
+derivation.
+
+.. code:: ipython2
+
+    # This is the straightforward version with no "compaction".
+    # It works fine, but does waaaay too much work because the
+    # expressions grow each derivation.
+    
+    def D(symbol):
+    
+        def derv(R):
+    
+            # ∂a(a) → λ
+            if R == {symbol}:
+                return y
+    
+            # ∂a(λ) → ϕ
+            # ∂a(ϕ) → ϕ
+            # ∂a(¬a) → ϕ
+            if R == y or R == phi or R in syms:
+                return phi
+            
+            tag = R[0]
+    
+            # ∂a(R*) → ∂a(R)∘R*
+            if tag == KSTAR:
+                return (CONS, derv(R[1]), R)
+    
+            # ∂a(¬R) → ¬∂a(R)
+            if tag == NOT:
+                return (NOT, derv(R[1]))
+    
+            r, s = R[1:]
+    
+            # ∂a(R∘S) → ∂a(R)∘S ∨ δ(R)∘∂a(S)
+            if tag == CONS:
+                A = (CONS, derv(r), s)  # A = ∂a(R)∘S
+                # A ∨ δ(R) ∘ ∂a(S)
+                # A ∨  λ   ∘ ∂a(S) → A ∨ ∂a(S)
+                # A ∨  ϕ   ∘ ∂a(S) → A ∨ ϕ → A
+                return (OR, A, derv(s)) if nully(r) else A
+    
+            # ∂a(R ∧ S) → ∂a(R) ∧ ∂a(S)
+            # ∂a(R ∨ S) → ∂a(R) ∨ ∂a(S)
+            return (tag, derv(r), derv(s))
+    
+        return derv
+
+Compaction Rules
+~~~~~~~~~~~~~~~~
+
+.. code:: ipython2
+
+    def _compaction_rule(relation, one, zero, a, b):
+        return (
+            b if a == one else  # R*1 = 1*R = R
+            a if b == one else
+            zero if a == zero or b == zero else  # R*0 = 0*R = 0
+            (relation, a, b)
+            )
+
+An elegant symmetry.
+
+.. code:: ipython2
+
+    # R ∧ I = I ∧ R = R
+    # R ∧ ϕ = ϕ ∧ R = ϕ
+    _and = curry(_compaction_rule, AND, I, phi)
+    
+    # R ∨ ϕ = ϕ ∨ R = R
+    # R ∨ I = I ∨ R = I
+    _or = curry(_compaction_rule, OR, phi, I)
+    
+    # R∘λ = λ∘R = R
+    # R∘ϕ = ϕ∘R = ϕ
+    _cons = curry(_compaction_rule, CONS, y, phi)
+
+Memoizing
+~~~~~~~~~
+
+We can save re-processing by remembering results we have already
+computed. RE datastructures are immutable and the ``derv()`` functions
+are *pure* so this is fine.
+
+.. code:: ipython2
+
+    class Memo(object):
+    
+        def __init__(self, f):
+            self.f = f
+            self.calls = self.hits = 0
+            self.mem = {}
+    
+        def __call__(self, key):
+            self.calls += 1
+            try:
+                result = self.mem[key]
+                self.hits += 1
+            except KeyError:
+                result = self.mem[key] = self.f(key)
+            return result
+
+With "Compaction"
+~~~~~~~~~~~~~~~~~
+
+This version uses the rules above to perform compaction. It keeps the
+expressions from growing too large.
+
+.. code:: ipython2
+
+    def D_compaction(symbol):
+    
+        @Memo
+        def derv(R):
+    
+            # ∂a(a) → λ
+            if R == {symbol}:
+                return y
+    
+            # ∂a(λ) → ϕ
+            # ∂a(ϕ) → ϕ
+            # ∂a(¬a) → ϕ
+            if R == y or R == phi or R in syms:
+                return phi
+    
+            tag = R[0]
+    
+            # ∂a(R*) → ∂a(R)∘R*
+            if tag == KSTAR:
+                return _cons(derv(R[1]), R)
+    
+            # ∂a(¬R) → ¬∂a(R)
+            if tag == NOT:
+                return (NOT, derv(R[1]))
+    
+            r, s = R[1:]
+    
+            # ∂a(R∘S) → ∂a(R)∘S ∨ δ(R)∘∂a(S)
+            if tag == CONS:
+                A = _cons(derv(r), s)  # A = ∂a(r)∘s
+                # A ∨ δ(R) ∘ ∂a(S)
+                # A ∨  λ   ∘ ∂a(S) → A ∨ ∂a(S)
+                # A ∨  ϕ   ∘ ∂a(S) → A ∨ ϕ → A
+                return _or(A, derv(s)) if nully(r) else A
+    
+            # ∂a(R ∧ S) → ∂a(R) ∧ ∂a(S)
+            # ∂a(R ∨ S) → ∂a(R) ∨ ∂a(S)
+            dr, ds = derv(r), derv(s)
+            return _and(dr, ds) if tag == AND else _or(dr, ds)
+    
+        return derv
+
+Let's try it out...
+-------------------
+
+(FIXME: redo.)
+
+.. code:: ipython2
+
+    o, z = D_compaction('0'), D_compaction('1')
+    REs = set()
+    N = 5
+    names = list(product(*(N * [(0, 1)])))
+    dervs = list(product(*(N * [(o, z)])))
+    for name, ds in zip(names, dervs):
+        R = it
+        ds = list(ds)
+        while ds:
+            R = ds.pop()(R)
+            if R == phi or R == I:
+                break
+            REs.add(R)
+    
+    print stringy(it) ; print
+    print o.hits, '/', o.calls
+    print z.hits, '/', z.calls
+    print
+    for s in sorted(map(stringy, REs), key=lambda n: (len(n), n)):
+        print s
+
+
+.. parsed-literal::
+
+    (.111.) & ((.01 | 11*)')
+    
+    92 / 122
+    92 / 122
+    
+    (.01)'
+    (.01 | 1)'
+    (.01 | ^)'
+    (.01 | 1*)'
+    (.111.) & ((.01 | 1)')
+    (.111. | 11.) & ((.01 | ^)')
+    (.111. | 11. | 1.) & ((.01)')
+    (.111. | 11.) & ((.01 | 1*)')
+    (.111. | 11. | 1.) & ((.01 | 1*)')
+
+
+Should match:
+
+::
+
+    (.111.) & ((.01 | 11*)')
+
+    92 / 122
+    92 / 122
+
+    (.01     )'
+    (.01 | 1 )'
+    (.01 | ^ )'
+    (.01 | 1*)'
+    (.111.)            & ((.01 | 1 )')
+    (.111. | 11.)      & ((.01 | ^ )')
+    (.111. | 11.)      & ((.01 | 1*)')
+    (.111. | 11. | 1.) & ((.01     )')
+    (.111. | 11. | 1.) & ((.01 | 1*)')
+
+Larger Alphabets
+----------------
+
+We could parse larger alphabets by defining patterns for e.g. each byte
+of the ASCII code. Or we can generalize this code. If you study the code
+above you'll see that we never use the "set-ness" of the symbols ``O``
+and ``l``. The only time Python set operators (``&`` and ``|``) appear
+is in the ``nully()`` function, and there they operate on (recursively
+computed) outputs of that function, never ``O`` and ``l``.
+
+What if we try:
+
+::
+
+    (OR, O, l)
+
+    ∂1((OR, O, l))
+                                ∂a(R ∨ S) → ∂a(R) ∨ ∂a(S)
+    ∂1(O) ∨ ∂1(l)
+                                ∂a(¬a) → ϕ
+    ϕ ∨ ∂1(l)
+                                ∂a(a) → λ
+    ϕ ∨ λ
+                                ϕ ∨ R = R
+    λ
+
+And compare it to:
+
+::
+
+    {'0', '1')
+
+    ∂1({'0', '1'))
+                                ∂a(R ∨ S) → ∂a(R) ∨ ∂a(S)
+    ∂1({'0')) ∨ ∂1({'1'))
+                                ∂a(¬a) → ϕ
+    ϕ ∨ ∂1({'1'))
+                                ∂a(a) → λ
+    ϕ ∨ λ
+                                ϕ ∨ R = R
+    λ
+
+This suggests that we should be able to alter the functions above to
+detect sets and deal with them appropriately. Exercise for the Reader
+for now.
+
+State Machine
+-------------
+
+We can drive the regular expressions to flesh out the underlying state
+machine transition table.
+
+::
+
+    .111. & (.01 + 11*)'
+
+Says, "Three or more 1's and not ending in 01 nor composed of all 1's."
+
+.. figure:: omg.svg
+   :alt: omg.svg
+
+   omg.svg
+
+Start at ``a`` and follow the transition arrows according to their
+labels. Accepting states have a double outline. (Graphic generated with
+`Dot from Graphviz <http://www.graphviz.org/>`__.) You'll see that only
+paths that lead to one of the accepting states will match the regular
+expression. All other paths will terminate at one of the non-accepting
+states.
+
+There's a happy path to ``g`` along 111:
+
+::
+
+    a→c→e→g
+
+After you reach ``g`` you're stuck there eating 1's until you see a 0,
+which takes you to the ``i→j→i|i→j→h→i`` "trap". You can't reach any
+other states from those two loops.
+
+If you see a 0 before you see 111 you will reach ``b``, which forms
+another "trap" with ``d`` and ``f``. The only way out is another happy
+path along 111 to ``h``:
+
+::
+
+    b→d→f→h
+
+Once you have reached ``h`` you can see as many 1's or as many 0' in a
+row and still be either still at ``h`` (for 1's) or move to ``i`` (for
+0's). If you find yourself at ``i`` you can see as many 0's, or
+repetitions of 10, as there are, but if you see just a 1 you move to
+``j``.
+
+RE to FSM
+~~~~~~~~~
+
+So how do we get the state machine from the regular expression?
+
+It turns out that each RE is effectively a state, and each arrow points
+to the derivative RE in respect to the arrow's symbol.
+
+If we label the initial RE ``a``, we can say:
+
+::
+
+    a --0--> ∂0(a)
+    a --1--> ∂1(a)
+
+And so on, each new unique RE is a new state in the FSM table.
+
+Here are the derived REs at each state:
+
+::
+
+    a = (.111.) & ((.01 | 11*)')
+    b = (.111.) & ((.01 | 1)')
+    c = (.111. | 11.) & ((.01 | 1*)')
+    d = (.111. | 11.) & ((.01 | ^)')
+    e = (.111. | 11. | 1.) & ((.01 | 1*)')
+    f = (.111. | 11. | 1.) & ((.01)')
+    g = (.01 | 1*)'
+    h = (.01)'
+    i = (.01 | 1)'
+    j = (.01 | ^)'
+
+You can see the one-way nature of the ``g`` state and the ``hij`` "trap"
+in the way that the ``.111.`` on the left-hand side of the ``&``
+disappears once it has been matched.
+
+.. code:: ipython2
+
+    from collections import defaultdict
+    from pprint import pprint
+    from string import ascii_lowercase
+
+.. code:: ipython2
+
+    d0, d1 = D_compaction('0'), D_compaction('1')
+
+``explore()``
+~~~~~~~~~~~~~
+
+.. code:: ipython2
+
+    def explore(re):
+    
+        # Don't have more than 26 states...
+        names = defaultdict(iter(ascii_lowercase).next)
+    
+        table, accepting = dict(), set()
+    
+        to_check = {re}
+        while to_check:
+    
+            re = to_check.pop()
+            state_name = names[re]
+    
+            if (state_name, 0) in table:
+                continue
+    
+            if nully(re):
+                accepting.add(state_name)
+    
+            o, i = d0(re), d1(re)
+            table[state_name, 0] = names[o] ; to_check.add(o)
+            table[state_name, 1] = names[i] ; to_check.add(i)
+    
+        return table, accepting
+
+.. code:: ipython2
+
+    table, accepting = explore(it)
+    table
+
+
+
+
+.. parsed-literal::
+
+    {('a', 0): 'b',
+     ('a', 1): 'c',
+     ('b', 0): 'b',
+     ('b', 1): 'd',
+     ('c', 0): 'b',
+     ('c', 1): 'e',
+     ('d', 0): 'b',
+     ('d', 1): 'f',
+     ('e', 0): 'b',
+     ('e', 1): 'g',
+     ('f', 0): 'b',
+     ('f', 1): 'h',
+     ('g', 0): 'i',
+     ('g', 1): 'g',
+     ('h', 0): 'i',
+     ('h', 1): 'h',
+     ('i', 0): 'i',
+     ('i', 1): 'j',
+     ('j', 0): 'i',
+     ('j', 1): 'h'}
+
+
+
+.. code:: ipython2
+
+    accepting
+
+
+
+
+.. parsed-literal::
+
+    {'h', 'i'}
+
+
+
+Generate Diagram
+~~~~~~~~~~~~~~~~
+
+Once we have the FSM table and the set of accepting states we can
+generate the diagram above.
+
+.. code:: ipython2
+
+    _template = '''\
+    digraph finite_state_machine {
+      rankdir=LR;
+      size="8,5"
+      node [shape = doublecircle]; %s;
+      node [shape = circle];
+    %s
+    }
+    '''
+    
+    def link(fr, nm, label):
+        return '  %s -> %s [ label = "%s" ];' % (fr, nm, label)
+    
+    
+    def make_graph(table, accepting):
+        return _template % (
+            ' '.join(accepting),
+            '\n'.join(
+              link(from_, to, char)
+              for (from_, char), (to) in sorted(table.iteritems())
+              )
+            )
+
+.. code:: ipython2
+
+    print make_graph(table, accepting)
+
+
+.. parsed-literal::
+
+    digraph finite_state_machine {
+      rankdir=LR;
+      size="8,5"
+      node [shape = doublecircle]; i h;
+      node [shape = circle];
+      a -> b [ label = "0" ];
+      a -> c [ label = "1" ];
+      b -> b [ label = "0" ];
+      b -> d [ label = "1" ];
+      c -> b [ label = "0" ];
+      c -> e [ label = "1" ];
+      d -> b [ label = "0" ];
+      d -> f [ label = "1" ];
+      e -> b [ label = "0" ];
+      e -> g [ label = "1" ];
+      f -> b [ label = "0" ];
+      f -> h [ label = "1" ];
+      g -> i [ label = "0" ];
+      g -> g [ label = "1" ];
+      h -> i [ label = "0" ];
+      h -> h [ label = "1" ];
+      i -> i [ label = "0" ];
+      i -> j [ label = "1" ];
+      j -> i [ label = "0" ];
+      j -> h [ label = "1" ];
+    }
+    
+
+
+Drive a FSM
+~~~~~~~~~~~
+
+There are *lots* of FSM libraries already. Once you have the state
+transition table they should all be straightforward to use. State
+Machine code is very simple. Just for fun, here is an implementation in
+Python that imitates what "compiled" FSM code might look like in an
+"unrolled" form. Most FSM code uses a little driver loop and a table
+datastructure, the code below instead acts like JMP instructions
+("jump", or GOTO in higher-level-but-still-low-level languages) to
+hard-code the information in the table into a little patch of branches.
+
+Trampoline Function
+^^^^^^^^^^^^^^^^^^^
+
+Python has no GOTO statement but we can fake it with a "trampoline"
+function.
+
+.. code:: ipython2
+
+    def trampoline(input_, jump_from, accepting):
+        I = iter(input_)
+        while True:
+            try:
+                bounce_to = jump_from(I)
+            except StopIteration:
+                return jump_from in accepting
+            jump_from = bounce_to
+
+Stream Functions
+^^^^^^^^^^^^^^^^
+
+Little helpers to process the iterator of our data (a "stream" of "1"
+and "0" characters, not bits.)
+
+.. code:: ipython2
+
+    getch = lambda I: int(next(I))
+    
+    
+    def _1(I):
+        '''Loop on ones.'''
+        while getch(I): pass
+    
+    
+    def _0(I):
+        '''Loop on zeros.'''
+        while not getch(I): pass
+
+A Finite State Machine
+^^^^^^^^^^^^^^^^^^^^^^
+
+With those preliminaries out of the way, from the state table of
+``.111. & (.01 + 11*)'`` we can immediately write down state machine
+code. (You have to imagine that these are GOTO statements in C or
+branches in assembly and that the state names are branch destination
+labels.)
+
+.. code:: ipython2
+
+    a = lambda I: c if getch(I) else b
+    b = lambda I: _0(I) or d
+    c = lambda I: e if getch(I) else b
+    d = lambda I: f if getch(I) else b
+    e = lambda I: g if getch(I) else b
+    f = lambda I: h if getch(I) else b
+    g = lambda I: _1(I) or i
+    h = lambda I: _1(I) or i
+    i = lambda I: _0(I) or j
+    j = lambda I: h if getch(I) else i
+
+Note that the implementations of ``h`` and ``g`` are identical ergo
+``h = g`` and we could eliminate one in the code but ``h`` is an
+accepting state and ``g`` isn't.
+
+.. code:: ipython2
+
+    def acceptable(input_):
+        return trampoline(input_, a, {h, i})
+
+.. code:: ipython2
+
+    for n in range(2**5):
+        s = bin(n)[2:]
+        print '%05s' % s, acceptable(s)
+
+
+.. parsed-literal::
+
+        0 False
+        1 False
+       10 False
+       11 False
+      100 False
+      101 False
+      110 False
+      111 False
+     1000 False
+     1001 False
+     1010 False
+     1011 False
+     1100 False
+     1101 False
+     1110 True
+     1111 False
+    10000 False
+    10001 False
+    10010 False
+    10011 False
+    10100 False
+    10101 False
+    10110 False
+    10111 True
+    11000 False
+    11001 False
+    11010 False
+    11011 False
+    11100 True
+    11101 False
+    11110 True
+    11111 False
+
+
+Reversing the Derivatives to Generate Matching Strings
+------------------------------------------------------
+
+(UNFINISHED) Brzozowski also shewed how to go from the state machine to
+strings and expressions...
+
+Each of these states is just a name for a Brzozowskian RE, and so, other
+than the initial state ``a``, they can can be described in terms of the
+derivative-with-respect-to-N of some other state/RE:
+
+::
+
+    c = d1(a)
+    b = d0(a)
+    b = d0(c)
+    ...
+    i = d0(j)
+    j = d1(i)
+
+Consider:
+
+::
+
+    c = d1(a)
+    b = d0(c)
+
+Substituting:
+
+::
+
+    b = d0(d1(a))
+
+Unwrapping:
+
+::
+
+    b = d10(a)
+
+'''
+
+::
+
+    j = d1(d0(j))
+
+Unwrapping:
+
+::
+
+    j = d1(d0(j)) = d01(j)
+
+We have a loop or "fixed point".
+
+::
+
+    j = d01(j) = d0101(j) = d010101(j) = ...
+
+hmm...
+
+::
+
+    j = (01)*
index a201c0d..e518de6 100644 (file)
@@ -468,10 +468,8 @@ Putting it all together:
 Project Euler Problem Two
 -------------------------
 
-::
-
-    By considering the terms in the Fibonacci sequence whose values do not exceed four million,
-    find the sum of the even-valued terms.
+    By considering the terms in the Fibonacci sequence whose values do
+    not exceed four million, find the sum of the even-valued terms.
 
 Now that we have a generator for the Fibonacci sequence, we need a
 function that adds a term in the sequence to a sum if it is even, and
index b4dc1a7..b882803 100644 (file)
@@ -3,7 +3,7 @@
 
     from notebook_preamble import D, DefinitionWrapper, J, V, define
 
-Recursive Combinators
+Recursion Combinators
 =====================
 
 This article describes the ``genrec`` combinator, how to use it, and
diff --git a/docs/sphinx_docs/notebooks/The_Four_Operations.rst b/docs/sphinx_docs/notebooks/The_Four_Operations.rst
new file mode 100644 (file)
index 0000000..f099eea
--- /dev/null
@@ -0,0 +1,337 @@
+
+The Four Fundamental Operations of Definite Action
+==================================================
+
+All definite actions (computer program) can be defined by four
+fundamental patterns of combination:
+
+1. Sequence
+2. Branch
+3. Loop
+4. Parallel
+
+Sequence
+--------
+
+Do one thing after another. In joy this is represented by putting two
+symbols together, juxtaposition:
+
+::
+
+    foo bar
+
+Operations have inputs and outputs. The outputs of ``foo`` must be
+compatible in "arity", type, and shape with the inputs of ``bar``.
+
+Branch
+------
+
+Do one thing or another.
+
+::
+
+    boolean [F] [T] branch
+
+
+       t [F] [T] branch
+    ----------------------
+              T
+
+
+       f [F] [T] branch
+    ----------------------
+          F
+
+
+    branch == unit cons swap pick i
+
+    boolean [F] [T] branch
+    boolean [F] [T] unit cons swap pick i
+    boolean [F] [[T]] cons swap pick i
+    boolean [[F] [T]] swap pick i
+    [[F] [T]] boolean pick i
+    [F-or-T] i
+
+Given some branch function ``G``:
+
+::
+
+    G == [F] [T] branch
+
+Used in a sequence like so:
+
+::
+
+    foo G bar
+
+The inputs and outputs of ``F`` and ``T`` must be compatible with the
+outputs for ``foo`` and the inputs of ``bar``, respectively.
+
+::
+
+    foo F bar
+
+    foo T bar
+
+``ifte``
+~~~~~~~~
+
+Often it will be easier on the programmer to write branching code with
+the predicate specified in a quote. The ``ifte`` combinator provides
+this (``T`` for "then" and ``E`` for "else"):
+
+::
+
+    [P] [T] [E] ifte
+
+Defined in terms of ``branch``:
+
+::
+
+    ifte == [nullary not] dip branch
+
+In this case, ``P`` must be compatible with the stack and return a
+Boolean value, and ``T`` and ``E`` both must be compatible with the
+preceeding and following functions, as described above for ``F`` and
+``T``. (Note that in the current implementation we are depending on
+Python for the underlying semantics, so the Boolean value doesn't *have*
+to be Boolean because Python's rules for "truthiness" will be used to
+evaluate it. I reflect this in the structure of the stack effect comment
+of ``branch``, it will only accept Boolean values, and in the definition
+of ``ifte`` above by including ``not`` in the quote, which also has the
+effect that the subject quotes are in the proper order for ``branch``.)
+
+Loop
+----
+
+Do one thing zero or more times.
+
+::
+
+    boolean [Q] loop
+
+
+       t [Q] loop
+    ----------------
+       Q [Q] loop
+
+
+       ... f [Q] loop
+    --------------------
+       ...
+
+The ``loop`` combinator generates a copy of itself in the true branch.
+This is the hallmark of recursive defintions. In Thun there is no
+equivalent to conventional loops. (There is, however, the ``x``
+combinator, defined as ``x == dup i``, which permits recursive
+constructs that do not need to be directly self-referential, unlike
+``loop`` and ``genrec``.)
+
+::
+
+    loop == [] swap [dup dip loop] cons branch
+
+    boolean [Q] loop
+    boolean [Q] [] swap [dup dip loop] cons branch
+    boolean [] [Q] [dup dip loop] cons branch
+    boolean [] [[Q] dup dip loop] branch
+
+In action the false branch does nothing while the true branch does:
+
+::
+
+    t [] [[Q] dup dip loop] branch
+          [Q] dup dip loop
+          [Q] [Q] dip loop
+          Q [Q] loop
+
+Because ``loop`` expects and consumes a Boolean value, the ``Q``
+function must be compatible with the previous stack *and itself* with a
+boolean flag for the next iteration:
+
+::
+
+    Q == G b
+
+    Q [Q] loop
+    G b [Q] loop
+    G Q [Q] loop
+    G G b [Q] loop
+    G G Q [Q] loop
+    G G G b [Q] loop
+    G G G
+
+``while``
+~~~~~~~~~
+
+Keep doing ``B`` *while* some predicate ``P`` is true. This is
+convenient as the predicate function is made nullary automatically and
+the body function can be designed without regard to leaving a Boolean
+flag for the next iteration:
+
+::
+
+                [P] [B] while
+    --------------------------------------
+       [P] nullary [B [P] nullary] loop
+
+
+    while == swap [nullary] cons dup dipd concat loop
+
+
+    [P] [B] while
+    [P] [B] swap [nullary] cons dup dipd concat loop
+    [B] [P] [nullary] cons dup dipd concat loop
+    [B] [[P] nullary] dup dipd concat loop
+    [B] [[P] nullary] [[P] nullary] dipd concat loop
+    [P] nullary [B] [[P] nullary] concat loop
+    [P] nullary [B [P] nullary] loop
+
+Parallel
+--------
+
+The *parallel* operation indicates that two (or more) functions *do not
+interfere* with each other and so can run in parallel. The main
+difficulty in this sort of thing is orchestrating the recombining
+("join" or "wait") of the results of the functions after they finish.
+
+The current implementaions and the following definitions *are not
+actually parallel* (yet), but there is no reason they couldn't be
+reimplemented in terms of e.g. Python threads. I am not concerned with
+performance of the system just yet, only the elegance of the code it
+allows us to write.
+
+``cleave``
+~~~~~~~~~~
+
+Joy has a few parallel combinators, the main one being ``cleave``:
+
+::
+
+                   ... x [A] [B] cleave
+    ---------------------------------------------------------
+       ... [x ...] [A] infra first [x ...] [B] infra first
+    ---------------------------------------------------------
+                       ... a b
+
+The ``cleave`` combinator expects a value and two quotes and it executes
+each quote in "separate universes" such that neither can affect the
+other, then it takes the first item from the stack in each universe and
+replaces the value and quotes with their respective results.
+
+(I think this corresponds to the "fork" operator, the little
+upward-pointed triangle, that takes two functions ``A :: x -> a`` and
+``B :: x -> b`` and returns a function ``F :: x -> (a, b)``, in Conal
+Elliott's "Compiling to Categories" paper, et. al.)
+
+Just a thought, if you ``cleave`` two jobs and one requires more time to
+finish than the other you'd like to be able to assign resources
+accordingly so that they both finish at the same time.
+
+"Apply" Functions
+~~~~~~~~~~~~~~~~~
+
+There are also ``app2`` and ``app3`` which run a single quote on more
+than one value:
+
+::
+
+                     ... y x [Q] app2
+     ---------------------------------------------------------
+        ... [y ...] [Q] infra first [x ...] [Q] infra first
+
+
+            ... z y x [Q] app3
+     ---------------------------------
+        ... [z ...] [Q] infra first
+            [y ...] [Q] infra first
+            [x ...] [Q] infra first
+
+Because the quoted program can be ``i`` we can define ``cleave`` in
+terms of ``app2``:
+
+::
+
+    cleave == [i] app2 [popd] dip
+
+(I'm not sure why ``cleave`` was specified to take that value, I may
+make a combinator that does the same thing but without expecting a
+value.)
+
+::
+
+    clv == [i] app2
+
+       [A] [B] clv
+    ------------------
+         a b
+
+``map``
+~~~~~~~
+
+The common ``map`` function in Joy should also be though of as a
+*parallel* operator:
+
+::
+
+    [a b c ...] [Q] map
+
+There is no reason why the implementation of ``map`` couldn't distribute
+the ``Q`` function over e.g. a pool of worker CPUs.
+
+``pam``
+~~~~~~~
+
+One of my favorite combinators, the ``pam`` combinator is just:
+
+::
+
+    pam == [i] map
+
+This can be used to run any number of programs separately on the current
+stack and combine their (first) outputs in a result list.
+
+::
+
+       [[A] [B] [C] ...] [i] map
+    -------------------------------
+       [ a   b   c  ...]
+
+Handling Other Kinds of Join
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The ``cleave`` operators and others all have pretty brutal join
+semantics: everything works and we always wait for every
+sub-computation. We can imagine a few different potentially useful
+patterns of "joining" results from parallel combinators.
+
+first-to-finish
+^^^^^^^^^^^^^^^
+
+Thinking about variations of ``pam`` there could be one that only
+returns the first result of the first-to-finish sub-program, or the
+stack could be replaced by its output stack.
+
+The other sub-programs would be cancelled.
+
+"Fulminators"
+^^^^^^^^^^^^^
+
+Also known as "Futures" or "Promises" (by *everybody* else. "Fulinators"
+is what I was going to call them when I was thinking about implementing
+them in Thun.)
+
+The runtime could be amended to permit "thunks" representing the results
+of in-progress computations to be left on the stack and picked up by
+subsequent functions. These would themselves be able to leave behind
+more "thunks", the values of which depend on the eventual resolution of
+the values of the previous thunks.
+
+In this way you can create "chains" (and more complex shapes) out of
+normal-looking code that consist of a kind of call-graph interspersed
+with "asyncronous" ... events?
+
+In any case, until I can find a rigorous theory that shows that this
+sort of thing works perfectly in Joy code I'm not going to worry about
+it. (And I think the Categories can deal with it anyhow? Incremental
+evaluation, yeah?)
diff --git a/docs/sphinx_docs/notebooks/TypeChecking.rst b/docs/sphinx_docs/notebooks/TypeChecking.rst
new file mode 100644 (file)
index 0000000..1bbc33c
--- /dev/null
@@ -0,0 +1,172 @@
+
+Type Checking
+=============
+
+.. code:: ipython2
+
+    import logging, sys
+    
+    logging.basicConfig(
+      format='%(message)s',
+      stream=sys.stdout,
+      level=logging.INFO,
+      )
+
+.. code:: ipython2
+
+    from joy.utils.polytypes import (
+        doc_from_stack_effect, 
+        infer,
+        reify,
+        unify,
+        FUNCTIONS,
+        JoyTypeError,
+    )
+
+.. code:: ipython2
+
+    D = FUNCTIONS.copy()
+    del D['product']
+    globals().update(D)
+
+An Example
+----------
+
+.. code:: ipython2
+
+    fi, fo = infer(pop, swap, rolldown, rrest, ccons)[0]
+
+
+.. parsed-literal::
+
+     25 (--) ∘ pop swap rolldown rrest ccons
+     28 (a1 --) ∘ swap rolldown rrest ccons
+     31 (a3 a2 a1 -- a2 a3) ∘ rolldown rrest ccons
+     34 (a4 a3 a2 a1 -- a2 a3 a4) ∘ rrest ccons
+     37 ([a4 a5 ...1] a3 a2 a1 -- a2 a3 [...1]) ∘ ccons
+     40 ([a4 a5 ...1] a3 a2 a1 -- [a2 a3 ...1]) ∘ 
+
+
+.. code:: ipython2
+
+    print doc_from_stack_effect(fi, fo)
+
+
+.. parsed-literal::
+
+    ([a4 a5 ...1] a3 a2 a1 -- [a2 a3 ...1])
+
+
+.. code:: ipython2
+
+    from joy.parser import text_to_expression
+    from joy.utils.stack import stack_to_string
+
+
+.. code:: ipython2
+
+    e = text_to_expression('0 1 2 [3 4]')  # reverse order
+    print stack_to_string(e)
+
+
+.. parsed-literal::
+
+    [3 4] 2 1 0
+
+
+.. code:: ipython2
+
+    u = unify(e, fi)[0]
+    u
+
+
+
+
+.. parsed-literal::
+
+    {a1: 0, a2: 1, a3: 2, a4: 3, a5: 4, s2: (), s1: ()}
+
+
+
+.. code:: ipython2
+
+    g = reify(u, (fi, fo))
+    print doc_from_stack_effect(*g)
+
+
+.. parsed-literal::
+
+    (... [3 4 ] 2 1 0 -- ... [1 2 ])
+
+
+Unification Works "in Reverse"
+------------------------------
+
+.. code:: ipython2
+
+    e = text_to_expression('[2 3]')
+
+.. code:: ipython2
+
+    u = unify(e, fo)[0]  # output side, not input side
+    u
+
+
+
+
+.. parsed-literal::
+
+    {a2: 2, a3: 3, s2: (), s1: ()}
+
+
+
+.. code:: ipython2
+
+    g = reify(u, (fi, fo))
+    print doc_from_stack_effect(*g)
+
+
+.. parsed-literal::
+
+    (... [a4 a5 ] 3 2 a1 -- ... [2 3 ])
+
+
+Failing a Check
+---------------
+
+.. code:: ipython2
+
+    fi, fo = infer(dup, mul)[0]
+
+
+.. parsed-literal::
+
+     25 (--) ∘ dup mul
+     28 (a1 -- a1 a1) ∘ mul
+     31 (f1 -- f2) ∘ 
+     31 (i1 -- i2) ∘ 
+
+
+.. code:: ipython2
+
+    e = text_to_expression('"two"')
+    print stack_to_string(e)
+
+
+.. parsed-literal::
+
+    'two'
+
+
+.. code:: ipython2
+
+    try:
+        unify(e, fi)
+    except JoyTypeError, err:
+        print err
+
+
+.. parsed-literal::
+
+    Cannot unify 'two' and f1.
+
diff --git a/docs/sphinx_docs/notebooks/omg.svg b/docs/sphinx_docs/notebooks/omg.svg
new file mode 100644 (file)
index 0000000..a3be69c
--- /dev/null
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.38.0 (20140413.2041)
+ -->
+<!-- Title: finite_state_machine Pages: 1 -->
+<svg width="534pt" height="270pt"
+ viewBox="0.00 0.00 534.00 270.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 266)">
+<title>finite_state_machine</title>
+<polygon fill="white" stroke="none" points="-4,4 -4,-266 530,-266 530,4 -4,4"/>
+<!-- i -->
+<g id="node1" class="node"><title>i</title>
+<ellipse fill="none" stroke="black" cx="338" cy="-146" rx="18" ry="18"/>
+<ellipse fill="none" stroke="black" cx="338" cy="-146" rx="22" ry="22"/>
+<text text-anchor="middle" x="338" y="-142.3" font-family="Times,serif" font-size="14.00">i</text>
+</g>
+<!-- i&#45;&gt;i -->
+<g id="edge17" class="edge"><title>i&#45;&gt;i</title>
+<path fill="none" stroke="black" d="M330.317,-166.991C329.369,-177.087 331.93,-186 338,-186 341.889,-186 344.337,-182.342 345.346,-177.059"/>
+<polygon fill="black" stroke="black" points="348.846,-177.102 345.683,-166.991 341.85,-176.868 348.846,-177.102"/>
+<text text-anchor="middle" x="338" y="-189.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- j -->
+<g id="node10" class="node"><title>j</title>
+<ellipse fill="none" stroke="black" cx="421" cy="-136" rx="18" ry="18"/>
+<text text-anchor="middle" x="421" y="-132.3" font-family="Times,serif" font-size="14.00">j</text>
+</g>
+<!-- i&#45;&gt;j -->
+<g id="edge18" class="edge"><title>i&#45;&gt;j</title>
+<path fill="none" stroke="black" d="M357.466,-135.495C363.775,-132.451 371.008,-129.536 378,-128 383.213,-126.855 388.811,-126.984 394.167,-127.763"/>
+<polygon fill="black" stroke="black" points="393.487,-131.197 404.002,-129.894 394.97,-124.355 393.487,-131.197"/>
+<text text-anchor="middle" x="381.5" y="-131.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- h -->
+<g id="node2" class="node"><title>h</title>
+<ellipse fill="none" stroke="black" cx="504" cy="-85" rx="18" ry="18"/>
+<ellipse fill="none" stroke="black" cx="504" cy="-85" rx="22" ry="22"/>
+<text text-anchor="middle" x="504" y="-81.3" font-family="Times,serif" font-size="14.00">h</text>
+</g>
+<!-- h&#45;&gt;i -->
+<g id="edge15" class="edge"><title>h&#45;&gt;i</title>
+<path fill="none" stroke="black" d="M481.868,-83.4025C461.033,-82.62 428.676,-83.5645 403,-94 387.267,-100.394 372.373,-112.028 360.918,-122.673"/>
+<polygon fill="black" stroke="black" points="358.306,-120.33 353.569,-129.807 363.182,-125.353 358.306,-120.33"/>
+<text text-anchor="middle" x="421" y="-97.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- h&#45;&gt;h -->
+<g id="edge16" class="edge"><title>h&#45;&gt;h</title>
+<path fill="none" stroke="black" d="M496.317,-105.991C495.369,-116.087 497.93,-125 504,-125 507.889,-125 510.337,-121.342 511.346,-116.059"/>
+<polygon fill="black" stroke="black" points="514.846,-116.102 511.683,-105.991 507.85,-115.868 514.846,-116.102"/>
+<text text-anchor="middle" x="504" y="-128.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- a -->
+<g id="node3" class="node"><title>a</title>
+<ellipse fill="none" stroke="black" cx="18" cy="-128" rx="18" ry="18"/>
+<text text-anchor="middle" x="18" y="-124.3" font-family="Times,serif" font-size="14.00">a</text>
+</g>
+<!-- b -->
+<g id="node4" class="node"><title>b</title>
+<ellipse fill="none" stroke="black" cx="255" cy="-113" rx="18" ry="18"/>
+<text text-anchor="middle" x="255" y="-109.3" font-family="Times,serif" font-size="14.00">b</text>
+</g>
+<!-- a&#45;&gt;b -->
+<g id="edge1" class="edge"><title>a&#45;&gt;b</title>
+<path fill="none" stroke="black" d="M36.2801,-126.897C76.7816,-124.312 178.091,-117.845 226.89,-114.73"/>
+<polygon fill="black" stroke="black" points="227.255,-118.214 237.011,-114.084 226.809,-111.229 227.255,-118.214"/>
+<text text-anchor="middle" x="136.5" y="-123.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- c -->
+<g id="node5" class="node"><title>c</title>
+<ellipse fill="none" stroke="black" cx="97" cy="-155" rx="18" ry="18"/>
+<text text-anchor="middle" x="97" y="-151.3" font-family="Times,serif" font-size="14.00">c</text>
+</g>
+<!-- a&#45;&gt;c -->
+<g id="edge2" class="edge"><title>a&#45;&gt;c</title>
+<path fill="none" stroke="black" d="M35.3297,-133.726C45.4364,-137.27 58.635,-141.898 70.1398,-145.932"/>
+<polygon fill="black" stroke="black" points="69.099,-149.276 79.6938,-149.282 71.4153,-142.67 69.099,-149.276"/>
+<text text-anchor="middle" x="57.5" y="-145.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- b&#45;&gt;b -->
+<g id="edge3" class="edge"><title>b&#45;&gt;b</title>
+<path fill="none" stroke="black" d="M248.266,-130.037C246.892,-139.858 249.137,-149 255,-149 258.665,-149 260.916,-145.429 261.753,-140.353"/>
+<polygon fill="black" stroke="black" points="265.252,-140.031 261.734,-130.037 258.252,-140.044 265.252,-140.031"/>
+<text text-anchor="middle" x="255" y="-152.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- d -->
+<g id="node6" class="node"><title>d</title>
+<ellipse fill="none" stroke="black" cx="338" cy="-79" rx="18" ry="18"/>
+<text text-anchor="middle" x="338" y="-75.3" font-family="Times,serif" font-size="14.00">d</text>
+</g>
+<!-- b&#45;&gt;d -->
+<g id="edge4" class="edge"><title>b&#45;&gt;d</title>
+<path fill="none" stroke="black" d="M272.003,-106.283C283.319,-101.533 298.722,-95.0674 311.693,-89.6227"/>
+<polygon fill="black" stroke="black" points="313.164,-92.801 321.03,-85.7034 310.455,-86.3466 313.164,-92.801"/>
+<text text-anchor="middle" x="294.5" y="-101.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- c&#45;&gt;b -->
+<g id="edge5" class="edge"><title>c&#45;&gt;b</title>
+<path fill="none" stroke="black" d="M114.862,-150.653C138.269,-144.593 181.917,-133.2 219,-123 221.799,-122.23 224.721,-121.414 227.631,-120.594"/>
+<polygon fill="black" stroke="black" points="228.623,-123.951 237.284,-117.849 226.708,-117.218 228.623,-123.951"/>
+<text text-anchor="middle" x="176" y="-142.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- e -->
+<g id="node7" class="node"><title>e</title>
+<ellipse fill="none" stroke="black" cx="176" cy="-206" rx="18" ry="18"/>
+<text text-anchor="middle" x="176" y="-202.3" font-family="Times,serif" font-size="14.00">e</text>
+</g>
+<!-- c&#45;&gt;e -->
+<g id="edge6" class="edge"><title>c&#45;&gt;e</title>
+<path fill="none" stroke="black" d="M112.483,-164.593C123.668,-172.001 139.356,-182.392 152.219,-190.911"/>
+<polygon fill="black" stroke="black" points="150.312,-193.846 160.582,-196.45 154.177,-188.01 150.312,-193.846"/>
+<text text-anchor="middle" x="136.5" y="-185.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- d&#45;&gt;b -->
+<g id="edge7" class="edge"><title>d&#45;&gt;b</title>
+<path fill="none" stroke="black" d="M320.205,-74.8763C311.208,-73.4911 300.131,-73.1424 291,-77 284.094,-79.9175 277.879,-84.9376 272.669,-90.3183"/>
+<polygon fill="black" stroke="black" points="269.694,-88.4067 265.791,-98.2568 274.985,-92.9902 269.694,-88.4067"/>
+<text text-anchor="middle" x="294.5" y="-80.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- f -->
+<g id="node8" class="node"><title>f</title>
+<ellipse fill="none" stroke="black" cx="176" cy="-46" rx="18" ry="18"/>
+<text text-anchor="middle" x="176" y="-42.3" font-family="Times,serif" font-size="14.00">f</text>
+</g>
+<!-- d&#45;&gt;f -->
+<g id="edge8" class="edge"><title>d&#45;&gt;f</title>
+<path fill="none" stroke="black" d="M319.923,-75.478C292.098,-69.7389 236.768,-58.3271 203.708,-51.5086"/>
+<polygon fill="black" stroke="black" points="204.321,-48.0614 193.82,-49.4692 202.907,-54.9171 204.321,-48.0614"/>
+<text text-anchor="middle" x="255" y="-69.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- e&#45;&gt;b -->
+<g id="edge9" class="edge"><title>e&#45;&gt;b</title>
+<path fill="none" stroke="black" d="M190.241,-194.796C198.908,-187.136 210.212,-176.503 219,-166 226.507,-157.028 233.803,-146.389 239.774,-137.007"/>
+<polygon fill="black" stroke="black" points="242.759,-138.834 245.056,-128.491 236.81,-135.144 242.759,-138.834"/>
+<text text-anchor="middle" x="215.5" y="-176.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- g -->
+<g id="node9" class="node"><title>g</title>
+<ellipse fill="none" stroke="black" cx="255" cy="-211" rx="18" ry="18"/>
+<text text-anchor="middle" x="255" y="-207.3" font-family="Times,serif" font-size="14.00">g</text>
+</g>
+<!-- e&#45;&gt;g -->
+<g id="edge10" class="edge"><title>e&#45;&gt;g</title>
+<path fill="none" stroke="black" d="M194.089,-207.11C203.659,-207.731 215.817,-208.521 226.677,-209.226"/>
+<polygon fill="black" stroke="black" points="226.753,-212.738 236.959,-209.893 227.207,-205.753 226.753,-212.738"/>
+<text text-anchor="middle" x="215.5" y="-211.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- f&#45;&gt;h -->
+<g id="edge12" class="edge"><title>f&#45;&gt;h</title>
+<path fill="none" stroke="black" d="M189.02,-33.1864C203.151,-19.5754 227.995,-0 254,-0 254,-0 254,-0 422,-0 453.632,-0 476.677,-31.2311 489.924,-55.8314"/>
+<polygon fill="black" stroke="black" points="486.862,-57.5325 494.518,-64.8562 493.1,-54.3566 486.862,-57.5325"/>
+<text text-anchor="middle" x="338" y="-3.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- f&#45;&gt;b -->
+<g id="edge11" class="edge"><title>f&#45;&gt;b</title>
+<path fill="none" stroke="black" d="M190.834,-56.7689C199.13,-63.3319 209.817,-71.9742 219,-80 224.034,-84.4001 229.343,-89.2757 234.262,-93.899"/>
+<polygon fill="black" stroke="black" points="231.917,-96.4985 241.576,-100.852 236.74,-91.4252 231.917,-96.4985"/>
+<text text-anchor="middle" x="215.5" y="-83.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- g&#45;&gt;i -->
+<g id="edge13" class="edge"><title>g&#45;&gt;i</title>
+<path fill="none" stroke="black" d="M269.741,-199.974C281.437,-190.587 298.524,-176.876 312.548,-165.622"/>
+<polygon fill="black" stroke="black" points="314.778,-168.32 320.387,-159.331 310.397,-162.86 314.778,-168.32"/>
+<text text-anchor="middle" x="294.5" y="-185.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- g&#45;&gt;g -->
+<g id="edge14" class="edge"><title>g&#45;&gt;g</title>
+<path fill="none" stroke="black" d="M248.266,-228.037C246.892,-237.858 249.137,-247 255,-247 258.665,-247 260.916,-243.429 261.753,-238.353"/>
+<polygon fill="black" stroke="black" points="265.252,-238.031 261.734,-228.037 258.252,-238.044 265.252,-238.031"/>
+<text text-anchor="middle" x="255" y="-250.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- j&#45;&gt;i -->
+<g id="edge19" class="edge"><title>j&#45;&gt;i</title>
+<path fill="none" stroke="black" d="M403.34,-139.8C397.561,-140.993 391.021,-142.205 385,-143 380.321,-143.618 375.357,-144.11 370.488,-144.502"/>
+<polygon fill="black" stroke="black" points="369.864,-141.036 360.126,-145.209 370.341,-148.02 369.864,-141.036"/>
+<text text-anchor="middle" x="381.5" y="-146.8" font-family="Times,serif" font-size="14.00">0</text>
+</g>
+<!-- j&#45;&gt;h -->
+<g id="edge20" class="edge"><title>j&#45;&gt;h</title>
+<path fill="none" stroke="black" d="M436.857,-126.646C447.841,-119.73 463.1,-110.122 476.194,-101.878"/>
+<polygon fill="black" stroke="black" points="478.237,-104.727 484.835,-96.4375 474.507,-98.8038 478.237,-104.727"/>
+<text text-anchor="middle" x="460.5" y="-116.8" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+</g>
+</svg>