diff --git a/docs/sphinx_docs/_build/html/_modules/joy/library.html b/docs/sphinx_docs/_build/html/_modules/joy/library.html index 7c4499a..06c4a01 100644 --- a/docs/sphinx_docs/_build/html/_modules/joy/library.html +++ b/docs/sphinx_docs/_build/html/_modules/joy/library.html @@ -157,13 +157,6 @@ dudipd == dup dipd primrec == [i] genrec step_zero == 0 roll> step -direco == dip rest cons -make_generator == [direco] cons [swap] swoncat cons -gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator -_within_P == [first - abs] dip <= -_within_B == roll< popop first -_within_R == [popd x] dip -within == x 0.000001 [_within_P] [_within_B] [_within_R] primrec ''' ##Zipper diff --git a/docs/sphinx_docs/_build/html/notebooks/4. Replacing Functions in the Dictionary.html b/docs/sphinx_docs/_build/html/notebooks/4. Replacing Functions in the Dictionary.html index 65f8e60..813ed5b 100644 --- a/docs/sphinx_docs/_build/html/notebooks/4. Replacing Functions in the Dictionary.html +++ b/docs/sphinx_docs/_build/html/notebooks/4. Replacing Functions in the Dictionary.html @@ -6,7 +6,7 @@ - Preamble — Thun 0.1.1 documentation + Replacing Functions in the Dictionary — Thun 0.1.1 documentation @@ -30,14 +30,13 @@
-
-

Preamble

+
+

Replacing Functions in the Dictionary

from notebook_preamble import D, J, V
 
-
-

A long trace

+

A long trace

V('[23 18] average')
 
@@ -86,31 +85,16 @@
-
-

Replacing sum and size with “compiled” versions.

-

Both sum and size are -catamorphisms, they -each convert a sequence to a single value.

-
J('[sum] help')
+
+

Replacing size with a Python Version

+

Both sum and size each convert a sequence to a single value.

+
 sum == 0 swap [+] step
+size == 0 swap [pop ++] step
 
-
Given a quoted sequence of numbers return the sum.
-
-sum == 0 swap [+] step
-
-
-
J('[size] help')
-
-
-
0 swap [pop ++] step
-
-
-

We can use “compiled” versions (they’re not really compiled in this -case, they’re hand-written in Python) to speed up evaluation and make -the trace more readable. The sum function is already in the library. -It gets shadowed by the definition version above during -initialize().

-
from joy.library import SimpleFunctionWrapper, primitives
+

An efficient sum function is already in the library. But for size we can use +a “compiled” version hand-written in Python to speed up evaluation and make the trace more readable.

+
from joy.library import SimpleFunctionWrapper
 from joy.utils.stack import iter_stack
 
 
@@ -122,17 +106,16 @@ It gets shadowed by the definition version above during
     for _ in iter_stack(sequence):
         n += 1
     return n, stack
-
-
-sum_ = next(p for p in primitives if p.name == 'sum')
 
-

Now we replace them old versions in the dictionary with the new versions +

Now we replace the old version in the dictionary with the new version, and re-evaluate the expression.

-
old_sum, D['sum'] = D['sum'], sum_
-old_size, D['size'] = D['size'], size
+
D['size'] = size
 
+
+
+

A Shorter Evaluation

You can see that size and sum now execute in a single step.

V('[23 18] average')
 
@@ -168,6 +151,7 @@ and re-evaluate the expression.

20.5 .
+
@@ -178,9 +162,12 @@ and re-evaluate the expression.

Table Of Contents

Related Topics

diff --git a/docs/sphinx_docs/_build/html/notebooks/AlsoNewton.html b/docs/sphinx_docs/_build/html/notebooks/AlsoNewton.html deleted file mode 100644 index f1ca011..0000000 --- a/docs/sphinx_docs/_build/html/notebooks/AlsoNewton.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - A Generator for Approximations — Thun 0.1.1 documentation - - - - - - - - - - - - - - - - - - -
-
-
-
- -
-

A Generator for Approximations

-

In Using x to Generate Values we derive a function G (called make_generator in the dictionary) that accepts an initial value and a quoted program and returns a new quoted program that, when driven by the x combinator (joy.library.x()), acts like a lazy stream.

-

To make a generator that generates successive approximations let’s start by assuming an initial approximation and then derive the function that computes the next approximation:

-
   a F
----------
-    a'
-
-
-
-

A Function to Compute the Next Approximation

-

Looking at the equation again:

-

\(a_{i+1} = \frac{(a_i+\frac{n}{a_i})}{2}\)

-
a n over / + 2 /
-a n a    / + 2 /
-a n/a      + 2 /
-a+n/a        2 /
-(a+n/a)/2
-
-
-

The function we want has the argument n in it:

-
F == n over / + 2 /
-
-
-
-
-

Make it into a Generator

-

Our generator would be created by:

-
a [dup F] make_generator
-
-
-

With n as part of the function F, but n is the input to the sqrt function we’re writing. If we let 1 be the initial approximation:

-
1 n 1 / + 2 /
-1 n/1   + 2 /
-1 n     + 2 /
-n+1       2 /
-(n+1)/2
-
-
-

The generator can be written as:

-
1 swap [over / + 2 /] cons [dup] swoncat make_generator
-
-
-

Example:

-
23 1 swap  [over / + 2 /] cons [dup] swoncat make_generator
-1 23       [over / + 2 /] cons [dup] swoncat make_generator
-1       [23 over / + 2 /]      [dup] swoncat make_generator
-1   [dup 23 over / + 2 /]                    make_generator
-.
-.
-.
-[1 swap [dup 23 over / + 2 /] direco]
-
-
-
-
-

A Generator of Square Root Approximations

-
gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator
-
-
-
-
-
-

Finding Consecutive Approximations within a Tolerance

-
-
The remainder of a square root finder is a function within, which takes a tolerance and a list of approximations and looks down the list for two successive approximations that differ by no more than the given tolerance.
-

From “Why Functional Programming Matters” by John -Hughes

-

(And note that by “list” he means a lazily-evaluated list.)

-

Using the output [a G] of the above generator for square root approximations, and further assuming that the first term a has been generated already and epsilon ε is handy on the stack…

-
   a [b G] ε within
----------------------- a b - abs ε <=
-      b
-
-
-
   a [b G] ε within
----------------------- a b - abs ε >
-       .
-   [b G] x ε ...
-   b [c G] ε ...
-       .
-----------------------
-   b [c G] ε within
-
-
-
-

Predicate

-
a [b G]             ε [first - abs] dip <=
-a [b G] first - abs ε                   <=
-a b           - abs ε                   <=
-a-b             abs ε                   <=
-abs(a-b)            ε                   <=
-(abs(a-b)<=ε)
-
-
-
P == [first - abs] dip <=
-
-
-
-
-

Base-Case

-
a [b G] ε roll< popop first
-  [b G] ε a     popop first
-  [b G]               first
-   b
-
-
-
B == roll< popop first
-
-
-
-
-

Recur

-
a [b G] ε R0 [within] R1
-
-
-
    -
  1. Discard a.
  2. -
  3. Use x combinator to generate next term from G.
  4. -
  5. Run within with i (it is a primrec function.)
  6. -
-
a [b G]        ε R0           [within] R1
-a [b G]        ε [popd x] dip [within] i
-a [b G] popd x ε              [within] i
-  [b G]      x ε              [within] i
-b [c G]        ε              [within] i
-b [c G]        ε               within
-
-b [c G] ε within
-
-
-
R0 == [popd x] dip
-
-
-
-
-

Setting up

-

The recursive function we have defined so far needs a slight preamble: x to prime the generator and the epsilon value to use:

-
[a G] x ε ...
-a [b G] ε ...
-
-
-
-
-

within

-

Giving us the following definitions:

-
_within_P == [first - abs] dip <=
-_within_B == roll< popop first
-_within_R == [popd x] dip
-within == x ε [_within_P] [_within_B] [_within_R] primrec
-
-
-
-
-
-

Finding Square Roots

-
sqrt == gsra within
-
-
-
- - -
-
-
- -
-
- - - - \ No newline at end of file diff --git a/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html b/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html index 1d0d61e..6688bee 100644 --- a/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html +++ b/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html @@ -40,146 +40,165 @@

Cf. “Why Functional Programming Matters” by John Hughes

-
-

Finding the Square-Root of a Number

-

Let’s define a function that computes this equation:

+
+

A Generator for Approximations

+

In Using x to Generate Values we derive a function (called make_generator in the dictionary) that accepts an initial value and a quoted program and returns a new quoted program that, when driven by the x combinator (joy.library.x()), acts like a lazy stream.

+

To make a generator that generates successive approximations let’s start by assuming an initial approximation and then derive the function that computes the next approximation:

+
   a F
+---------
+    a'
+
+
+
+

A Function to Compute the Next Approximation

+

Looking at the equation again:

\(a_{i+1} = \frac{(a_i+\frac{n}{a_i})}{2}\)

-
     n a Q
----------------
-   (a+n/a)/2
-
-n a tuck / + 2 /
+
a n over / + 2 /
 a n a    / + 2 /
 a n/a      + 2 /
 a+n/a        2 /
 (a+n/a)/2
 
-

We want it to leave n but replace a, so we execute it with unary:

-
Q == [tuck / + 2 /] unary
-
-
-
define('Q == [tuck / + 2 /] unary')
+

The function we want has the argument n in it:

+
F == n over / + 2 /
 
-
-

Compute the Error

-

And a function to compute the error:

-
n a sqr - abs
-|n-a**2|
+
+

Make it into a Generator

+

Our generator would be created by:

+
a [dup F] make_generator
 
-

This should be nullary so as to leave both n and a on the stack -below the error.

-
err == [sqr - abs] nullary
+

With n as part of the function F, but n is the input to the sqrt function we’re writing. If we let 1 be the initial approximation:

+
1 n 1 / + 2 /
+1 n/1   + 2 /
+1 n     + 2 /
+n+1       2 /
+(n+1)/2
 
-
define('err == [sqr - abs] nullary')
+

The generator can be written as:

+
1 swap [over / + 2 /] cons [dup] swoncat make_generator
+
+
+

Example:

+
23 1 swap  [over / + 2 /] cons [dup] swoncat make_generator
+1 23       [over / + 2 /] cons [dup] swoncat make_generator
+1       [23 over / + 2 /]      [dup] swoncat make_generator
+1   [dup 23 over / + 2 /]                    make_generator
+.
+.
+.
+[1 swap [dup 23 over / + 2 /] direco]
 
-
-

square-root

-

Now we can define a recursive program that expects a number n, an -initial estimate a, and an epsilon value ε, and that leaves on -the stack the square root of n to within the precision of the -epsilon value. (Later on we’ll refine it to generate the initial -estimate and hard-code an epsilon value.)

-
n a ε square-root
------------------
-      √n
+
+

A Generator of Square Root Approximations

+
gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator
 
-

If we apply the two functions Q and err defined above we get the -next approximation and the error on the stack below the epsilon.

-
n a ε [Q err] dip
-n a Q err ε
-n a'  err ε
-n a' e    ε
+
+
+
+

Finding Consecutive Approximations within a Tolerance

+
+
The remainder of a square root finder is a function within, which takes a tolerance and a list of approximations and looks down the list for two successive approximations that differ by no more than the given tolerance.
+

From “Why Functional Programming Matters” by John +Hughes

+

(And note that by “list” he means a lazily-evaluated list.)

+

Using the output [a G] of the above generator for square root approximations, and further assuming that the first term a has been generated already and epsilon ε is handy on the stack…

+
   a [b G] ε within
+---------------------- a b - abs ε <=
+      b
 
-

Let’s define a recursive function K from here.

-
n a' e ε K
-
-K == [P] [E] [R0] [R1] genrec
+
   a [b G] ε within
+---------------------- a b - abs ε >
+       .
+   [b G] x ε ...
+   b [c G] ε ...
+       .
+----------------------
+   b [c G] ε within
 
+
+

Predicate

+
a [b G]             ε [first - abs] dip <=
+a [b G] first - abs ε                   <=
+a b           - abs ε                   <=
+a-b             abs ε                   <=
+abs(a-b)            ε                   <=
+(abs(a-b)<=ε)
+
+
+
P == [first - abs] dip <=
+
+
+
-

Base-case

-

The predicate and the base case are obvious:

-
K == [<] [popop popd] [R0] [R1] genrec
+

Base-Case

+
a [b G] ε roll< popop first
+  [b G] ε a     popop first
+  [b G]               first
+   b
 
-
n a' e ε popop popd
-n a'           popd
-  a'
+
B == roll< popop first
 

Recur

-

The recursive branch is pretty easy. Discard the error and recur.

-
K == [<] [popop popd] [R0]   [R1] genrec
-K == [<] [popop popd] [R0 [K] R1] ifte
+
a [b G] ε R0 [within] R1
 
-
n a' e ε               R0 [K] R1
-n a' e ε popd [Q err] dip [K] i
-n a'   ε      [Q err] dip [K] i
-n a' Q err ε              [K] i
-n a''  e   ε               K
+
    +
  1. Discard a.
  2. +
  3. Use x combinator to generate next term from G.
  4. +
  5. Run within with i (it is a primrec function.)
  6. +
+
a [b G]        ε R0           [within] R1
+a [b G]        ε [popd x] dip [within] i
+a [b G] popd x ε              [within] i
+  [b G]      x ε              [within] i
+b [c G]        ε              [within] i
+b [c G]        ε               within
+
+b [c G] ε within
 
-

This fragment alone is pretty useful. (R1 is i so this is a primrec “primitive recursive” function.)

-
define('K == [<] [popop popd] [popd [Q err] dip] primrec')
-
-
-
J('25 10 0.001 dup K')
-
-
-
5.000000232305737
-
-
-
J('25 10 0.000001 dup K')
-
-
-
5.000000000000005
+
R0 == [popd x] dip
 
-
-

Initial Approximation and Epsilon

-

So now all we need is a way to generate an initial approximation and an -epsilon value:

-
square-root == dup 3 / 0.000001 dup K
-
-
-
define('square-root == dup 3 / 0.000001 dup K')
+
+

Setting up

+

The recursive function we have defined so far needs a slight preamble: x to prime the generator and the epsilon value to use:

+
[a G] x ε ...
+a [b G] ε ...
 
-
-

Examples

-
J('36 square-root')
+
+

within

+

Giving us the following definitions:

+
_within_P == [first - abs] dip <=
+_within_B == roll< popop first
+_within_R == [popd x] dip
+within == x ε [_within_P] [_within_B] [_within_R] primrec
 
-
6.000000000000007
-
-
J('4895048365636 square-root')
-
-
2212475.6192184356
+
+

Finding Square Roots

+
sqrt == gsra within
 
-
2212475.6192184356 * 2212475.6192184356
-
-
-
4895048365636.0
-
-
-
@@ -192,15 +211,21 @@ epsilon value:

Table Of Contents

  • Newton’s method
  • Quadratic formula
      diff --git a/docs/sphinx_docs/_build/html/objects.inv b/docs/sphinx_docs/_build/html/objects.inv index 677395a..e1e7db6 100644 Binary files a/docs/sphinx_docs/_build/html/objects.inv and b/docs/sphinx_docs/_build/html/objects.inv differ diff --git a/docs/sphinx_docs/_build/html/searchindex.js b/docs/sphinx_docs/_build/html/searchindex.js index 7c24c6f..c099fb7 100644 --- a/docs/sphinx_docs/_build/html/searchindex.js +++ b/docs/sphinx_docs/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["index","joy","lib","library","notebooks/4. Replacing Functions in the Dictionary","notebooks/Advent of Code 2017 December 1st","notebooks/Advent of Code 2017 December 2nd","notebooks/Advent of Code 2017 December 3rd","notebooks/Advent of Code 2017 December 4th","notebooks/Advent of Code 2017 December 5th","notebooks/Advent of Code 2017 December 6th","notebooks/AlsoNewton","notebooks/Categorical","notebooks/Developing","notebooks/Generator Programs","notebooks/Hylo-, Ana-, Cata-, and Para-morphisms - Recursion Combinators","notebooks/Intro","notebooks/Newton-Raphson","notebooks/NoUpdates","notebooks/Quadratic","notebooks/Trees","notebooks/Zipper","notebooks/index","parser","pretty","stack"],envversion:52,filenames:["index.rst","joy.rst","lib.rst","library.rst","notebooks/4. Replacing Functions in the Dictionary.rst","notebooks/Advent of Code 2017 December 1st.rst","notebooks/Advent of Code 2017 December 2nd.rst","notebooks/Advent of Code 2017 December 3rd.rst","notebooks/Advent of Code 2017 December 4th.rst","notebooks/Advent of Code 2017 December 5th.rst","notebooks/Advent of Code 2017 December 6th.rst","notebooks/AlsoNewton.rst","notebooks/Categorical.rst","notebooks/Developing.rst","notebooks/Generator Programs.rst","notebooks/Hylo-, Ana-, Cata-, and Para-morphisms - Recursion Combinators.rst","notebooks/Intro.rst","notebooks/Newton-Raphson.rst","notebooks/NoUpdates.rst","notebooks/Quadratic.rst","notebooks/Trees.rst","notebooks/Zipper.rst","notebooks/index.rst","parser.rst","pretty.rst","stack.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,""],concat:[3,1,1,""],cons:[3,1,1,""],dip:[3,1,1,""],dipd:[3,1,1,""],dipdd:[3,1,1,""],divmod_:[3,1,1,""],drop:[3,1,1,""],dup:[3,1,1,""],dupd:[3,1,1,""],dupdip:[3,1,1,""],first:[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,""],over:[3,1,1,""],parse:[3,1,1,""],pm:[3,1,1,""],pop:[3,1,1,""],popd:[3,1,1,""],popdd:[3,1,1,""],popop:[3,1,1,""],pred:[3,1,1,""],remove:[3,1,1,""],rest:[3,1,1,""],reverse:[3,1,1,""],rolldown:[3,1,1,""],rollup:[3,1,1,""],select:[3,1,1,""],sharing:[3,1,1,""],shunt:[3,1,1,""],sort_:[3,1,1,""],sqrt:[3,1,1,""],stack_:[3,1,1,""],step:[3,1,1,""],succ:[3,1,1,""],sum_:[3,1,1,""],swaack:[3,1,1,""],swap:[3,1,1,""],take:[3,1,1,""],times:[3,1,1,""],tuck:[3,1,1,""],uncons:[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:[23,4,1,""],Symbol:[23,2,1,""],text_to_expression:[23,1,1,""]},"joy.utils":{pretty_print:[24,0,0,"-"],stack:[25,0,0,"-"]},"joy.utils.pretty_print":{TracePrinter:[24,2,1,""]},"joy.utils.pretty_print.TracePrinter":{go:[24,5,1,""],viewer:[24,5,1,""]},"joy.utils.stack":{expression_to_string:[25,1,1,""],iter_stack:[25,1,1,""],list_to_stack:[25,1,1,""],pick:[25,1,1,""],pushback:[25,1,1,""],stack_to_string:[25,1,1,""]},joy:{joy:[1,0,0,"-"],library:[3,0,0,"-"],parser:[23,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","method","Python method"]},objtypes:{"0":"py:module","1":"py:function","2":"py:class","3":"py:classmethod","4":"py:exception","5":"py:method"},terms:{"0b11100111011011":13,"10m":15,"10n":15,"4ac":19,"5bkei":20,"\u03b5":[11,17],"abstract":[16,20],"boolean":[2,3,16,20],"break":[10,16],"byte":13,"case":[2,3,4,6,10,15,25],"class":[3,16,23,24,25],"default":[3,9,14,25],"export":[3,23],"final":[2,7,15],"float":[3,16,21,23],"function":[0,1,4,5,6,7,8,9,12,13,14,17,18,21,22,23,24,25],"g\u00e9rard":21,"import":[2,4,5,6,7,8,9,10,13,14,15,17,19,20,21],"int":[7,14,15,16,21,23,25],"new":[2,3,4,7,11,14,15,16,18,20],"public":18,"return":[1,3,4,6,7,9,10,11,13,15,16,19,20,23,24,25],"short":19,"static":[2,18],"switch":2,"true":[2,3,6,7,13,15,20],"try":[7,14,15],"void":[0,3],"while":[3,7,9,10,16,23,25],Adding:[16,22],And:[5,7,11,13,14,15,17,20,21,25],But:[0,6,12,13,15,16,20],CPS:16,For:[2,3,5,6,7,8,9,14,15,20,22,25],Going:6,Has:3,Its:3,Not:7,One:[2,16],RHS:20,TOS:[2,3,15],That:[13,15,20],The:[0,1,2,3,4,5,6,7,8,9,11,12,14,17,18,19,21,22,23,25],Then:[2,3,6,9,19,20],There:[7,9,15,20,25],These:[22,25],Use:[3,11,15],Using:[7,11,15,20],With:[5,11,15],__str__:24,_within_b:11,_within_p:11,_within_r:11,aaa:8,abbrevi:20,abl:19,about:[0,7,9,16,20,21,25],abov:[0,4,7,11,13,17,19,20],abs:[7,11,17],absolut:[7,16],accept:[1,2,3,11,13,15,16,20,21],access:[7,9],accomplish:19,accordingli:20,accumul:13,across:[7,9],act:11,action:[16,21],actual:[2,7,13,16,20],adapt:22,add:[3,5,6,7,13,14,16,19,24],add_alias:3,add_def:3,add_definit:[3,9,15,20],add_if_match:5,add_valu:9,added:[12,20],adding:[7,18],addit:[0,2,3,9,13,15,16,20],admit:7,advantag:15,after:[5,7,9,13,14,16],afterward:16,again:[2,3,7,9,11,13,16,20],against:[6,7],aggreg:[3,21],aka:[16,21],albrecht:0,algebra:20,algorithm:16,alia:3,alias:[3,16],align:[16,24],all:[3,5,6,13,14,15,16,17,20,24],alloc:7,allow:[15,18,20],almost:20,alon:17,along:[15,16,19],alphabet:3,alreadi:[4,7,11,21],also:[0,13,15,16,25],altern:[12,20],although:[5,12,20],altogeth:14,alwai:[7,13,15,18],amort:20,amount:7,analysi:[12,22],anamorph:16,ani:[9,12,13,16,18,20,21,23],annual:16,anonym:20,anoth:[5,15,20,25],answer:7,anyth:[2,3,16],aoc20017:6,aoc20173:7,aoc2017:[5,6,7,8,9,10],api:18,app1:3,app2:[3,4,6,16,19],app3:3,app:16,appear:[2,8,12,13,20],append:9,appli:[2,3,6,13,17,20],applic:14,approach:[13,19],archiv:0,aren:21,arg:[2,3],argument:[2,3,11,14,15,16,24,25],arithmet:2,ariti:2,around:[13,25],arrai:9,arrang:9,arriv:[14,20],articl:[0,12],ask:[7,12,14],aspect:[0,7],assembl:9,assert:[7,10],assign:25,associ:20,assum:[5,6,8,9,11],asterisk:20,attack:16,attempt:[0,1],attribut:3,automat:[12,15,22],avail:[0,8],averag:[4,16],avoid:20,awar:2,awkward:20,azur:22,back:[7,9,20],backward:[18,20],bag:16,banana:[15,20],bank:10,barb:15,base:[0,2,3,6,10,15,18],basic:[1,2,3,5,7,16,20],bear:9,beat:9,becaus:[2,3,5,6,7,9,15,16,20,21,25],becom:[5,19,20,25],been:[11,15,18,20,21],befor:[6,9,14,15,16,20],begin:[7,15,20],behavior:[18,20],behaviour:[0,1],behind:9,being:0,belong:9,below:[2,3,7,13,14,17,20,21],bespok:16,best:0,better:[7,13,14,20],between:[0,6,7,13],biannual:16,big:[7,9,20],binari:[0,14,16,20],binary_search_tre:20,binarybuiltinwrapp:3,bind:16,bingo:21,bit:[7,13,14,20],block:[10,13],bodi:[2,16,20],body_text:3,bool:[6,15],borrow:16,both:[2,4,7,9,13,15,16,17,19,25],bottom:14,boundari:7,bracket:[7,16,23],branch:[3,5,6,9,13,14,17,20],breakpoint:16,bring:[13,16],btree:22,buck:20,bug:[0,16],build:[15,16,20,21,25],built:[15,19],bundl:[2,3],burgeon:16,calcul:7,calculu:12,call:[2,11,15,16,18,19,24,25],caller:20,came:[9,20],can:[0,2,3,4,5,6,7,11,12,13,14,15,16,17,18,19,21,22,25],candid:6,captur:16,card:16,care:[7,13,25],carefulli:[20,21],carri:[5,7,15],cartesian:12,catamorph:4,categor:[0,19,22],categori:12,ccc:12,ccon:20,ceil:7,certain:[16,25],certainli:20,chang:[2,7,9,18,20,21],charact:21,chat:16,chatter:0,cheat:10,check:[6,14,15],checksum:6,child0:20,childn:20,children:20,choic:[3,15],choos:[18,20],circuit:12,circular:[5,20],cite_not:20,classmethod:3,clear:[3,7,13,16],cleav:[4,5,6,8,16,19],close:[0,1,12],clunki:13,cmp:22,cmp_:20,code:[0,1,12,15,17,20],collaps:15,collect:[12,14,16],column:7,combin:[0,3,8,11,13,14,16,19,21,22],come:[7,9,16],command:[5,16,19,20],common:[2,13,15],compar:[7,12],comparison:0,compel:12,compil:[2,9,12,15,16],complet:12,complex:[3,21],compos:15,compound:20,comput:[2,6,7,9,12,13,16,19,22],con:[3,6,9,10,11,13,14,15,16,19,21,25],conal:12,concat:[3,5,14,15,16,20],concaten:0,concatin:[0,3,25],concis:7,concret:15,concurr:2,condit:[9,16],condition:6,confid:7,conflict:20,cons2:20,consecut:14,consid:[9,13,14,15,20,21],consist:[2,7,16,20],constant:20,constitu:15,consum:[6,15],contain:[0,2,3,7,8,14,15,16],context:2,continu:[0,6,15,21],control:16,conveni:12,convert:[4,15,20,23,25],cook:15,cool:20,copi:[2,3,5,13,15,20,22],copyright:16,corner:7,correct:7,correctli:20,correspond:12,could:[2,7,9,12,13,15,16,18,20,21],count:[3,7,8,14],count_stat:10,counter:13,cours:[7,9,13,15,20],cover:7,cpu:7,crack:20,crap:22,crash:20,creat:[0,2,3,5,11,13,14,15,20],crude:[20,23],current:[2,3,9,15,16,21,24],custom:18,cycl:[13,14],cython:16,dai:[15,16],data:[2,3,7,22],datastructur:[0,2,15,21,23,25],datatyp:25,ddididi:21,deal:[0,5,20],debugg:15,decid:20,decor:3,decoupl:15,decreas:7,decrement:3,deduc:13,deeper:0,deepli:12,def:[3,4,7,9,10,15,16,19,20,25],defi:3,defin:[2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,21],definit:[2,3,4,8,9,11,13,14,15,16,18,20,22],definitionwrapp:[3,9,15,20],deleg:16,delet:22,demonstr:[12,15],depend:[15,20],deposit:20,dequot:[5,15],deriv:[2,3,5,6,11,13,16,22],descend:6,describ:[3,12,15,20,23],descript:[13,16,20],design:[2,3,6,20],desir:[7,16,20],destruct:20,detail:[7,16,20],detect:[6,14,15,20],determin:[6,7],develop:[0,14,16,22],diagram:13,dialect:1,dict:[1,3],dictionari:[1,3,4,11,16,19,20],did:7,didn:15,differ:[0,6,8,11,12,13,15,19,20,25],differenti:12,dig:21,digit:[5,13],dimension:7,dinfrirst:16,dip:[3,4,6,7,9,10,11,13,14,15,16,17,19,20],dipd:[3,9,14,15,16,19,20,21],dipdd:[3,20],direco:[10,11],direct:16,directli:[7,13,20,25],disappear:2,discard:[3,11,14,15,17,20],discov:6,disenstacken:[16,20],disk:16,displac:2,distanc:7,distribut:10,ditch:20,div:[3,16],dive:20,divid:6,divis:[6,20],divisor:6,divmod:[3,6],divmod_:3,doc:[2,3,16],document:[22,23,25],doe:[0,1,6,7,9,12,15,16,22,24],doesn:[5,9,13,15,18,20,25],dog:20,doing:[7,12,13,15,16,21],domain:[7,12],don:[6,7,9,13,16,20],done:[2,13,14,16,18],doodl:7,door:16,dot:24,doubl:[13,16],down:[2,3,7,9,11,21],down_to_zero:16,downward:9,dozen:16,draft:[10,12,18],dream:16,drive:14,driven:[11,13],driver:14,drop:[3,5,20],dudipd:16,due:5,dummi:6,dup:[3,5,6,7,9,10,11,13,14,15,16,17,19,20,21,25],dupd:3,dupdip:[3,6,7,13,15,19,20],duplic:[3,8,15,20],durat:2,dure:[2,4,15],each:[2,3,4,5,6,7,9,12,13,15,16,20,24],easi:[0,7,17,20,21],easier:[3,5,20],easili:12,edit:22,effect:[2,3,16,21],effici:[7,9,21],either:[1,2,3,6,15,20],eleg:[9,16,19,20],element:[2,3],elliott:12,els:[2,3,5,6,9,10,15],embed:[12,20,21],empti:[3,6,16,25],encapsul:16,enclos:16,encod:[9,14],encount:9,end:[7,9,13,15,25],endless:14,enforc:[2,16],engend:16,enlarg:7,enough:[7,15,16,19,24],enstacken:[14,16],ensur:8,enter:16,entir:25,entri:[3,21,24],epsilon:11,equal:[13,25],equat:[7,11,16,17],ergo:[7,15,20],err:[17,20],error:[7,16,22,23],escap:9,essai:0,estim:17,etc:[3,7,21,23],euler:22,eval:0,evalu:[1,2,3,4,5,11,15,16,19,20],even:9,evenli:6,eventu:[7,19],everi:14,everyth:[3,20],evolv:18,exactli:15,exampl:[0,3,5,6,7,8,9,11,13,14,15,20,23,25],exce:14,except:[16,20,23],execut:[0,1,2,3,4,6,16,17,21,25],exist:12,exit:9,expect:[2,3,6,15,17,20,25],experi:16,experiment:7,explan:16,explor:16,express:[0,1,2,3,4,12,15,20,21,24,25],expression_to_str:25,extend:7,extra:[5,6,13],extrem:16,extrememli:16,facet:0,facil:16,fact:[20,23],factor:[2,13,16,22],fail:[2,3,6,20,23],fals:[2,3,6,10,13,15],far:[9,11,15,20],fascin:0,fast:7,faster:7,favorit:19,fear:20,feel:7,few:[7,13,16],fewer:[3,16],fib:14,fib_gen:14,figur:[2,3,7,20],filter:20,fin:13,find:[2,3,5,6,13,14,20,22],finder:11,fine:[0,13,20],finish:19,first:[3,4,5,6,7,9,10,11,14,15,16,19,20,21,22],fit:[13,16,19],five:[13,15,16],fix:[2,3],flag:6,flatten:[16,20],flexibl:20,floor:[3,7],floordiv:13,flow:16,follow:[0,2,3,6,9,11,15,16,18,21],foo:[16,18,20],foo_ii:18,form:[2,3,6,8,12,13,14,22,25],forman:16,format:[22,24],formula:[0,7,13,22],forth:[5,9,16,20],fortun:9,forum:0,forward:[6,9],found:[9,10,16,20],four:[2,3,7,9,13,14,16,20],fourteen:13,fourth:[2,3,5,20],fractal:16,fraction0:16,fraction:[2,16],fragment:17,framework:16,free:[12,16,20],freeli:[2,7],from:[0,1,2,3,4,5,6,7,8,9,10,11,13,14,16,17,19,20,21,22,25],front:[2,3],full:[8,13],fun:7,functionwrapp:[3,20],funtion:20,further:[11,22],futur:19,garbag:16,gari:20,gcd:16,gen:10,gener:[2,3,7,9,12,17,22,25],genrec:[3,6,9,15,16,17,20],geometr:13,geometri:20,get:[2,4,6,7,12,13,14,15,16,17,22],get_valu:9,getitem:3,getrecursionlimit:25,getsourc:16,ghc:12,give:[7,11,12,13,15,25],given:[2,3,4,5,6,7,9,10,11,13,14,21],glue:16,goal:9,going:[6,7,9,20,21],good:[9,13,20],grab:3,grammar:23,grand:16,graph:7,great:[0,5,7,16,22],greater:[7,25],grid:7,group:[0,7],gsra:11,guard:[6,7],had:[13,21],haiku:16,half:[13,21],half_of_s:5,halfwai:5,hand:[4,16,19,20,22],handi:11,handl:25,happen:[7,16,20],hard:[17,21],hardli:15,hardwar:12,has:[0,2,6,7,9,11,14,15,16,18,20,21,25],haskel:12,have:[2,3,5,6,7,9,10,11,13,14,15,16,18,20,21,22,25],head:[6,15,25],help:[4,8,15,16,20],help_:3,helper:[3,6],herd:16,here:[7,13,14,15,17,19,20,21],heterogen:20,heurist:[5,9],hide:20,higher:[16,20],highest:6,highli:[16,20],hindsight:6,histori:24,hmm:20,hog:20,hoist:3,hold:13,hood:9,hope:[0,13,16,22],host:22,how:[0,7,8,9,12,15,20,21],html:[2,3,14,19,22],http:20,huet:21,hugh:[11,17,20],human:16,hypothet:2,id_:3,idea:[12,13,16,20],ident:[3,15],identifi:7,ift:[3,5,6,9,15,17,20],ignor:[3,20],illustr:15,imagin:21,immedi:[9,15],immut:[16,20],imper:15,implement:[0,1,2,3,7,10,12,15,16,18,19,20],impli:6,implicit:16,includ:[8,12],inclus:13,incom:25,incompat:18,incr_at:9,incr_step_count:9,incr_valu:9,increas:[7,9,13],increment:[3,12,13,18],index:[0,7,10,16,25],index_of:10,indexerror:25,indic:20,infil:20,infinit:7,inform:3,infra:[3,4,14,15,16,19],infrastructur:3,init:9,init_print:7,initi:[2,3,4,6,7,8,9,11,16,20],inlin:20,inner:6,input:[1,5,6,7,8,11,15],inscrib:3,inspect:16,instal:0,instanti:[12,24],instead:[7,13,14,15,20,21,25],instruct:9,integ:[2,3,5,6,7,8,9,14,15,16],integr:3,intend:[0,16],interact:[16,22],interest:[0,7,13,14,20],interlock:7,interlud:22,intermedi:15,intern:[0,24,25],interpret:[0,12,15,18,23,24],interrupt:16,interv:[12,13],introduc:18,introduct:0,invari:3,invers:3,investig:19,ipf:16,ipynb:14,isn:[15,21],item:[2,3,5,6,10,15,16,20,25],iter:[1,3,7,15,16,22,25],iter_stack:[4,10,25],its:[0,2,3,6,7,12,13,15,16,20,25],itself:[0,2,9,16,20],j05cmp:[2,3],jenni:20,job:[9,22],john:[11,17,20],joi:[2,4,5,6,8,9,10,11,12,18,19,20],joypi:[9,10,15,16,20,21],jump:9,jupyt:22,just:[0,2,3,5,6,7,9,14,15,16,18,21],keep:21,kei:22,kevin:0,key_n:20,keyerror:20,kind:[2,7,9,12,15,16,20],kleen:20,know:[7,13,15,20],known:12,labda:12,lambda:[12,15],lambdifi:7,languag:[12,16,18,19,20],larg:7,larger:[7,25],largest:[3,6,9],last:[5,9,13,15],lastli:[14,15],later:[9,16,17],law:2,lazi:11,lazili:11,lcm:13,lead:[9,16],leaf:20,lean:16,learn:[0,10],least:[2,7,9,13,15,25],least_fract:16,leav:[6,7,9,13,14,17,20],left:[7,14,15,16,21,24,25],leftov:15,legendari:9,legibl:9,len:10,length:[3,13,25],lens:15,less:[13,14,15,16,25],lesser:7,let:[5,6,7,9,11,14,15,17,19,20,21],level:[12,20],librari:[0,4,7,9,10,11,19,20],lieu:20,like:[2,3,6,7,10,11,13,15,16,19,23],line:[3,6,9,15,16,20,24],linear:25,link:0,linux:0,list:[0,3,5,6,8,9,10,11,13,16,21,22,24],list_to_stack:[9,10,25],liter:[1,20,21,23],littl:[7,9,20,22],live:22,lkei:20,load:[13,16],locat:[2,7],locu:24,log_2:20,logic:[0,13],longer:20,look:[7,11,14,16,20],lookup:[16,20],loop:[0,1,3,13],lot:[16,19,20,21],love:13,low:12,lower:13,lowest:6,machin:[0,20],machineri:20,macro:16,made:[0,6,16,20,21],mai:[2,9,15,20],mail:0,main:[0,3,5,16,21],mainloop:18,maintain:21,major:18,make:[2,3,4,5,12,13,15,16,21],make_distributor:10,make_gener:11,manfr:[0,2,3,12],manhattan:7,mani:[0,7,8,9,14,15,16],manipul:7,manual:[7,15],map:[1,3,13,15,16,18,19,20],map_:3,mark:[7,9],marker:16,mask:[13,14],match:[0,1,5],materi:0,math:[0,7,9,16,20],mathemat:[7,16],matter:[5,11,13,15,17,20],max:[6,7,10],max_:3,maximum:[3,20],maxmin:6,mayb:[15,20],maze:9,mean:[6,11,12,13,15,16,20,25],meant:[15,16,19,20],meantim:9,mem:9,member:[2,3,7],memori:7,mental:16,mention:2,mercuri:0,merg:20,meta:[16,20],methink:20,method:[0,3,7,16,22,24],mfloor:7,midpoint:13,might:[5,12,14,15,20],million:14,min:6,min_:3,mind:9,minimum:3,minu:[3,19],mirror:0,miscellan:[0,22],mistak:10,mix:16,mnemon:5,mod:3,model:[12,16],modern:0,modif:14,modifi:[9,16,21],modul:[0,1,3,16,23],modulu:16,monkei:7,month:16,more:[0,3,4,8,9,11,12,13,14,15,16,19,20,23,25],most:20,mostli:0,move:[5,7,9],movement:2,mrank_of:7,much:[7,9,13,15,20],muck:20,mul:[16,19,21,24],multi:3,multipl:[15,22],must:[2,3,6,7,8,13,15,18],mutabl:9,n_kei:20,n_rang:14,n_valu:20,nail:9,name:[1,3,4,5,16,18,21,22,23,25],natur:[13,14,20],navig:21,need:[2,3,5,6,7,9,10,11,13,14,15,17,18,20],neg:[3,9,19],nest:[16,20,21],network:16,never:18,newton:[0,22],next:[4,5,6,7,9,13,15,17,20],nice:[0,5,7,15,25],niether:2,node:22,non:[6,20],none:[1,3],normal:[8,15],notat:[16,20],note:[2,7,11,13,20,25],notebook:[13,16,21,22],notebook_preambl:[2,4,5,6,7,8,9,10,13,14,15,17,19,20,21],noth:[2,20],notic:13,now:[4,5,6,7,13,14,15,16,17,22],nth:[3,25],nullari:[6,9,10,16,17,20],number:[1,2,3,4,6,13,14,22,25],object:23,observ:13,obviou:[14,17],obvious:[6,8,9],occur:20,odd:[13,14],off:[2,3,7,13,14,21],offset:9,offset_of:7,old:[2,4],old_siz:4,old_sum:4,omit:15,onc:[3,8,18,19,20],one:[2,3,5,6,7,8,9,13,14,15,19,20,24,25],ones:14,onli:[2,3,5,6,7,9,13,15,20,21,25],onto:[1,2,3,16,25],open:[8,16],oper:[3,6,15,16,20,25],oppos:5,option:[1,16,25],order:[2,3,5,6,15,16,22,25],org:[0,20],origin:[0,1,2,3,5,20,21],other:[0,2,3,6,7,12,15,16,20,25],otherwis:[3,6,13,14,20],our:[5,6,7,11,13,14,15,16],ourselv:15,out:[2,3,7,12,13,14,15,16,20,21],outcom:20,output:[7,11,15],outsid:[9,12],outward:7,over:[3,5,7,11,12,13,14,16,19,20,22],overhead:7,overkil:15,overshadow:7,own:[7,20],pack:[20,25],packag:[0,16],page:[0,19,20,25],pair:[2,3,5,6,13,14],pair_up:5,palidrom:13,palindrom:13,pam:[16,19],paper:[7,12,15,16,20,21],parallel:2,paramet:[1,2,3,9,15,23,24,25],paranthes:20,parenthes:[9,20,25],pariti:14,pars:[0,3,16,20],parse_definit:3,parseerror:23,parser:0,part:[2,3,6,9,11,15,19,20],partial:[7,15],particular:21,particularli:9,pass:[0,20,24],passphras:8,path:7,pattern:[7,13,20],payoff:15,pe1:[13,14],pe2:14,pearl:21,pend:[3,15,16,21,24],peopl:22,per:[7,16],perform:9,perhap:14,period:16,permit:[9,25],persist:20,phase:2,pick:[13,14,25],pickl:16,pictur:20,piec:15,pip:0,pita:10,place:[3,7,9,13,15,16],plai:0,plain:9,plane:7,plu:[3,7,19],plug:[14,15,20],point:[7,12,15,16,20],pointless:2,pop:[3,4,5,6,9,10,13,14,15,16,19,20,25],popd:[3,4,9,11,16,17],popdd:[3,6,14,19],popop:[3,5,6,9,10,11,13,14,15,16,17,20],port:7,posit:[3,9,13,15,16],possibilit:20,possibl:[6,20,22],post:[16,20],potenti:3,power:16,pragmat:13,pre:[9,15,20],preambl:11,precis:[0,1,17],pred:3,predic:[2,6,14,15,17],prefer:15,prefix:[15,24],prep:[6,20],prepar:[9,15],preprocessor:15,present:20,preserv:12,pretti:[7,17,19,20,24,25],pretty_print:0,prevent:15,previou:[7,9,16],prime:[6,11],primit:[2,3,4,9,17,19],primrec:[3,6,9,10,11,14,15,16,17],print:[0,1,2,3,7,15,24,25],probabl:[5,14,16,20],problem:[7,16,22],proc_curr:20,proc_left:20,proc_right:20,proce:[5,13],process:[9,15,16,24],processor:20,produc:[5,13,15,20],product:16,program:[0,2,3,5,6,7,9,11,14,16,17,21],project:22,prompt:16,proper:[2,3],properli:9,properti:0,provid:[0,3,12,16],prune:20,pun:[0,16],pure:[0,20],puriti:16,purpos:16,push:[2,3,15,16,21,25],pushback:[16,20,25],put:[1,2,14,16,25],puzzl:[5,6,7,8],pypi:0,pyramid:7,python:[0,2,3,4,7,9,15,19,20,21,23,25],quadrat:[0,7,22],queri:20,queu:15,quit:[0,1,7],quot:[0,3,4,11,14,15,16,19,20,21,24],quotat:[2,3],quotient:3,rais:[20,23,25],random:9,rang:[7,15,16],range_sum:15,range_to_zero:16,rank_and_offset:7,rank_of:7,raphson:17,rather:[13,15,16,20],ratio:16,reach:[9,13,14,15],read:[0,1,13,14,20,21],readabl:4,real:20,realiz:[5,9,12,20],realli:[4,7],rearrang:[2,15],reason:[7,13,16],rebuild:21,rec1:[2,3],rec2:[2,3],recogn:23,record:[16,24],recur:15,recurs:[2,3,6,9,10,11,14,16,17,22,25],recus:16,recusr:20,redistribut:[3,16],reduc:2,redund:25,reexamin:20,refactor:[15,16,18],refer:[0,2],refin:17,regist:2,regular:23,rel:[9,19],releas:18,relev:7,remain:[2,3,16,18],remaind:[3,11],remind:15,remov:[3,7,20,25],renam:20,render:[20,22],repeat:[5,7,13],repeatedli:13,repl:[0,1],replac:[2,3,14,15,17,21,25],repositori:0,repres:[2,16,20,23,24],represent:25,reprod:14,request:7,requir:[7,25],resembl:16,respect:13,rest:[3,6,10,13,14,16,20,21,22,25],restor:2,result:[1,2,3,6,13,14,15,19,20,21],resum:16,retir:2,retri:16,reus:20,revers:[3,5,6,13,14,15,21,25],rewrit:[9,16],rewritten:16,richard:20,right:[7,14,15,16,24,25],rightmost:13,rkei:20,role:20,roll:[3,6,8,9,11,15,19,20],rolldown:3,rollup:3,root:[3,7,19,22],rotate_seq:5,round:5,row:[6,7],row_valu:7,run:[0,1,3,7,11,13,15,16,20,21],runtim:7,runtimeerror:25,sai:20,same:[2,12,13,15,20,25],sandwich:[2,3],save:[2,13,16],scan:3,scanner:[16,23],scenario:21,scheme:[19,20],scope:[5,20],search:[0,7,20],second:[3,5,6,15,16,20,25],secur:8,see:[0,4,7,14,15,16,18,20,21,24],seem:[0,10,13,16,20],seen:21,select:[3,7],semant:[2,3,16,18,20],semi:16,send:16,sens:[0,2,13,21],separ:16,sequenc:[0,1,2,3,4,5,6,8,9,10,13,16,20,21,23],seri:[7,13,14,15,20,21],serv:15,set:[2,3,15],seven:[13,14],sever:[0,12,16],shadow:4,share:[3,7,16],shelf:2,shift:[13,14],shine:9,shortest:7,should:[2,6,13,15,17,20],shouldn:16,show:[7,12,20,21],shunt:[3,21],side:20,sign:7,signal:6,signifi:[16,20],silli:20,similar:20,simon:16,simpl:[7,15,16,25],simplefunctionwrapp:[3,4,9,10,19],simplest:22,simpli:12,simplifi:[7,13,20,21],sinc:[2,7,13,19,20],singl:[3,4,14,16,23],situ:20,situat:20,six:[13,14,16],sixti:[13,14],size:[5,8,9,10,16],skeptic:16,skip:[7,9],slight:11,slightli:[15,20],small:[5,20],smallest:[3,6],smart:[9,15],sneaki:7,softwar:16,solei:2,solut:[7,13],solv:7,solvabl:16,some:[2,3,6,7,9,14,15,16,20,22,25],somehow:20,someth:[2,5,9,18],sometim:20,somewher:[15,20,22],sophist:7,sort:[3,6,15,19,20],sort_:3,sourc:[0,1,3,23,24,25],space:[7,13,24],span:13,special:[14,15,20],specif:[0,12],speed:[4,7,9],sphinx:[22,25],spiral:7,spirit:[0,1,20],split_at:5,spreadsheet:6,sqr:[16,17,19,21],sqrt:[3,7,11,19],squar:[3,7,22,23],stack:[0,1,3,4,6,9,10,11,13,14,15,17,19,20,21,23,24],stack_:3,stack_to_str:25,stage:20,stai:[0,1],stand:12,standard:16,star:20,stare:20,start:[6,7,9,10,11,13,14,15,16,19,20],state:[6,9,16],step:[3,4,5,6,7,8,13,16,19,20,21],step_zero:[5,6,8],still:[7,9,15],stop:20,storag:[13,15,20],store:[7,13,15],stori:15,str:[1,23,24,25],straightforward:[1,5,7,14],strang:9,stream:[11,13],string:[1,2,3,5,16,21,23,24,25],strip:7,structur:[15,16,20,21,25],stuff:20,style:[0,12],sub:18,subclass:16,subject:21,subract:7,substitut:[7,15],subtract:[6,7,13],succ:3,success:11,suffici:[9,15],suggest:[6,12,20],suitabl:[3,12,13],sum:[3,5,6,14,15,16,19,20],sum_:[3,4],summand:13,suppli:[15,20,23],support:[7,16,24,25],sure:[7,15],suspect:2,swaack:[3,4,15,19,20,21],swap:[3,4,5,6,7,8,10,11,13,14,15,16,20,21],swon:[3,10,14,15,16,20,21],swoncat:[9,10,11,14,15,16,20],symbol:[2,3,7,19,21,23],symmetr:13,sympi:19,syntact:16,syntax:[16,25],sys:[7,25],system:[7,8,16,20],tail:[6,20,25],take:[3,5,7,9,11,13,14,16,19,20,25],taken:9,talk:[16,20,25],target:[7,21],task:7,tast:12,tbd:16,technic:2,techniqu:[12,21],technolog:2,teh:20,temporari:21,ten:13,term:[1,2,6,9,10,11,15,16,23,25],termin:[2,3,6],ternari:16,test:[2,3],text:[0,1,3],text_to_express:[16,23],textual:16,than:[0,3,7,8,11,13,14,16,19,25],thei:[2,4,6,7,13,14,15,16,20,21,23,25],them:[2,3,4,6,7,13,14,15,20,21,22],theori:[2,3],therefor:[14,20],thi:[0,1,2,3,4,5,6,7,9,10,12,13,14,15,16,17,19,21,23,24,25],thing:[2,6,7,9,14,15,19,20,21,23,25],think:[2,9,13,15,16,20],third:[3,5,6,14,16,20],thirti:13,those:[2,3,6,7,9,15,20,22],though:[13,14,20],thought:16,thousand:13,thread:2,three:[2,3,9,13,16,20],through:[1,13,16,21,25],thu:5,thun:[2,3,12,18],thunder:16,tied:20,tile:7,time:[3,7,9,10,13,15,16,20,21],tini:20,to_set:20,todai:16,todo:[16,22,23],togeth:[14,16],token:23,tommi:20,too:[15,20],took:7,tool:16,top:[2,3,16,24,25],total:[5,7,13],total_match:5,trace:[0,16,19,21,25],traceprint:24,track:21,tracker:0,trade:7,transform:[12,15],translat:[7,12,15],travers:[21,22],treasur:0,treat:[0,2,3,22],treatment:14,tree:[0,16,22],treemap:15,tri:13,trick:[13,20],tricki:[7,9],trivial:[6,9,20],trobe:0,trove:0,truediv:19,truthi:[3,16],ts0:[15,20],ts1:[15,20],tuck:[3,6,16,17,20],tupl:[3,16,25],turn:[2,3,7],twice:[7,15,20],two:[2,3,6,7,11,13,15,16,17,20,21,25],type:[1,12,15,16,22,23,24,25],typic:[2,3],unari:[9,15,16,17],unarybuiltinwrapp:3,unbalanc:23,uncon:[3,5,6,14,15,16,20,21],under:[2,3,9,16],understand:[0,7,20],undocu:16,unfortun:25,uniqu:[3,8,20],unit:[5,15,16,20],univers:[0,16],unless:[7,15],unlik:15,unnecessari:22,unpack:[2,3,25],unpair:13,unquot:[15,16,20],unstack:3,untangl:[14,15],until:[6,7,9,14],unus:13,unusu:20,updat:[0,22],upward:9,usag:16,use:[0,2,3,4,7,9,11,12,13,14,16,18,19,20,21,25],used:[3,12,15,16,20,21,23,25],useful:[0,17],user:7,uses:[2,6,13,15],using:[3,6,7,14,15,19,20,21],usual:[0,2],util:[0,4,9,10,20],valid:8,valu:[2,3,4,6,7,11,13,15,16,17,22,25],value_n:20,valueerror:25,vanilla:9,variabl:[15,22],variat:15,varient:20,varieti:[12,16],variou:0,vener:25,verbos:12,veri:[0,1,7,12,16,20,25],versa:2,version:[0,1,2,14,18,19,21,22],via:16,vice:2,view:22,viewer:[1,16,18,24],von:[0,2,3,12],wai:[0,2,3,5,7,9,12,13,15,16,17,20],walk:20,wall:7,want:[2,7,9,11,13,14,17,20],warranti:[3,16],wash:16,wast:16,web:25,websit:[0,13],welcom:16,well:[0,5,6,7,12,16,20,23],were:[7,9,15,16,21],what:[2,3,6,9,10,12,15,16,19,20,24],whatev:[2,3,14,20,25],when:[11,13,14,15,16,20,21,23,25],where:[2,3,5,6,9,15,16,20,22,25],whether:15,which:[0,1,3,6,7,9,11,13,15,16,19,20,21,25],whole:[2,3,6,13,20],whose:14,why:[7,11,17,20],wiki:20,wikipedia:[0,20,21],wildli:16,wind:16,winner:7,wire:15,wit:9,within:[16,17,20],without:[2,16,20],won:[20,25],word:[0,3,5,6,8,13,14,16,20,21],work:[0,5,6,7,9,13,14,15,16,20,21,25],worth:[7,13],would:[2,6,7,8,9,10,11,13,14,15,16,20,21,25],wouldn:9,wrap:[3,7,16],write:[5,7,9,11,12,14,15,20,21,22,25],written:[0,1,4,9,11,19,25],wrong:2,wtf:15,wtfmorphism:15,year:16,yet:[9,15,20,21],yield:[2,3,25],you:[0,2,3,4,6,7,9,13,14,15,16,18,20,21,24,25],your:[2,3,5,6,7,8,16],yourself:[16,20],zero:[3,6,7,9,15,20,23,25],zip:[5,13],zip_:3,zstr:21},titles:["Thun 0.1.1 Documentation","Joy Interpreter","Functions Grouped by, er, Function with Examples","Function Reference","Preamble","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","A Generator for Approximations","Categorical Programming","Developing a Program in Joy","Using x to Generate Values","Hylomorphism","Thun: Joy in Python","Newton\u2019s method","No Updates","Quadratic formula","Treating Trees","Preamble","Essays about Programming in Joy","Parsing Text into Joy Expressions","Tracing Joy Execution","Stack or Quote or Sequence or List\u2026"],titleterms:{"1st":5,"2nd":6,"3rd":7,"4th":8,"5th":9,"6th":10,"case":[11,17,20],"final":6,"function":[2,3,10,11,15,16,19,20],"long":4,"void":2,"while":2,Adding:20,One:14,The:[13,15,16,20],There:16,Use:20,Using:14,about:22,abov:15,add:[2,9,20],adding:20,address:21,advent:[5,6,7,8,9,10],all:[7,9],ana:15,analysi:[7,13],anamorph:[2,15],app1:2,app2:2,app3:2,appendix:15,approxim:[11,17],automat:20,averag:2,base:[11,17,20],befor:10,better:15,binari:2,block:6,branch:2,breakdown:9,btree:20,can:20,cata:15,catamorph:15,categor:12,chatter:2,check:19,child:20,choic:2,cleanup:19,clear:2,cleav:2,cmp:20,code:[5,6,7,8,9,10,16],combin:[2,15,20],compar:20,comparison:2,compil:[4,14],comput:[11,17],con:[2,20],concat:2,consecut:11,continu:16,count:[9,10],crap:20,current:20,data:20,datastructur:[16,20],decemb:[5,6,7,8,9,10],defin:[19,20],definit:19,delet:20,deriv:[15,19,20],determin:21,develop:13,dialect:0,dip:[2,21],dipd:2,dipdd:2,direco:14,disenstacken:2,div:2,document:0,doe:20,down:6,down_to_zero:2,drive:10,drop:2,dup:2,dupd:2,dupdip:2,els:20,empti:20,enstacken:2,epsilon:17,equal:20,error:17,essai:22,euler:[13,14],eval:16,even:14,exampl:[2,16,17],execut:24,express:[16,23],extract:[15,20],factor:[15,20],factori:15,fibonacci:14,filter:13,find:[7,11,15,17],first:[2,13],five:14,flatten:2,floordiv:2,form:[15,20],formula:19,four:15,from:15,ftw:5,fun:15,further:13,fusion:15,gcd:2,gener:[10,11,13,14,15,20],genrec:2,get:[9,20],getitem:2,given:[15,20],gotten:9,greater:20,group:2,help:2,host:0,how:[10,13,14],hylo:15,hylomorph:15,ift:2,increment:9,index:9,indic:0,inform:0,infra:[2,20,21],initi:17,integ:13,interlud:20,intern:23,interpret:[1,16],isn:20,item:21,iter:[13,20],joi:[0,1,3,7,13,15,16,21,22,23,24,25],just:[13,20],kei:20,languag:0,law:15,least_fract:2,left:20,less:20,let:13,librari:[3,16],like:20,list:[2,15,20,25],literari:16,littl:13,logic:2,loop:[2,6,16],lshift:2,make:[11,20],mani:[10,13],map:2,math:2,method:17,min:2,miscellan:[2,20],mod:2,modif:20,modulu:2,mul:2,multipl:[13,14],must:20,name:[19,20],nativ:19,neg:2,newton:17,next:11,node:[15,20],now:[9,20],nullari:2,number:[7,15,17],offset:7,one:16,onli:16,order:20,osdn:0,our:20,out:6,over:2,pack:13,pam:2,paper:6,para:15,paramet:20,parameter:[15,20],paramorph:15,pars:[2,23],parser:[16,23],pass:16,path:21,pattern:15,per:20,piec:6,pop:2,popd:2,popop:2,pow:2,power:14,preambl:[4,9,15,21],pred:2,predic:[9,11,13,20],pretty_print:24,primrec:2,print:16,problem:[13,14],process:20,product:2,program:[10,12,13,15,19,20,22],project:[0,13,14],pure:16,put:[7,20],python:16,quadrat:19,quick:0,quot:[2,25],rang:[2,13],range_to_zero:2,rank:7,read:16,recal:10,recur:[11,17,20],recurs:[15,20],redefin:20,refactor:[5,13,20],refer:3,regular:16,rem:2,remaind:2,remov:2,render:13,repeat:10,repl:16,replac:4,rescu:7,reset:14,rest:[2,15],revers:2,right:[20,21],roll:2,rolldown:2,rollup:2,root:[11,17],rshift:2,run:[2,14],sat:6,second:2,select:2,sequenc:[14,25],set:[9,11,20],should:16,shunt:2,simplest:13,simplifi:19,size:[2,4],slight:20,sqr:2,sqrt:2,squar:[11,17],stack:[2,16,25],start:0,state:10,step:[2,9,15],style:16,sub:2,succ:2,sum:[2,4,13],swaack:2,swap:2,swon:2,swoncat:2,symbol:[15,16],sympi:7,tabl:0,tail:15,take:2,term:[13,14,20],ternari:2,text:23,than:[15,20],thi:20,think:6,third:2,three:14,thun:[0,16],time:[2,14],todo:20,togeth:[7,9,20],toi:20,token:16,toler:11,trace:[4,24],traceprint:16,travers:20,treat:20,tree:[15,20,21],treestep:[15,20],triangular:15,tricki:6,truediv:2,truthi:2,tuck:2,two:14,type:20,unari:2,uncon:2,unfinish:15,unit:2,unnecessari:13,unquot:2,unstack:2,updat:18,use:15,usual:15,util:[24,25],valu:[9,14,20],variabl:19,version:[4,7,13,20],view:16,want:6,within:11,word:2,write:19,xor:2,zero:14,zip:2,zipper:21}}) \ No newline at end of file +Search.setIndex({docnames:["index","joy","lib","library","notebooks/4. Replacing Functions in the Dictionary","notebooks/Advent of Code 2017 December 1st","notebooks/Advent of Code 2017 December 2nd","notebooks/Advent of Code 2017 December 3rd","notebooks/Advent of Code 2017 December 4th","notebooks/Advent of Code 2017 December 5th","notebooks/Advent of Code 2017 December 6th","notebooks/Categorical","notebooks/Developing","notebooks/Generator Programs","notebooks/Hylo-, Ana-, Cata-, and Para-morphisms - Recursion Combinators","notebooks/Intro","notebooks/Newton-Raphson","notebooks/NoUpdates","notebooks/Quadratic","notebooks/Trees","notebooks/Zipper","notebooks/index","parser","pretty","stack"],envversion:52,filenames:["index.rst","joy.rst","lib.rst","library.rst","notebooks/4. Replacing Functions in the Dictionary.rst","notebooks/Advent of Code 2017 December 1st.rst","notebooks/Advent of Code 2017 December 2nd.rst","notebooks/Advent of Code 2017 December 3rd.rst","notebooks/Advent of Code 2017 December 4th.rst","notebooks/Advent of Code 2017 December 5th.rst","notebooks/Advent of Code 2017 December 6th.rst","notebooks/Categorical.rst","notebooks/Developing.rst","notebooks/Generator Programs.rst","notebooks/Hylo-, Ana-, Cata-, and Para-morphisms - Recursion Combinators.rst","notebooks/Intro.rst","notebooks/Newton-Raphson.rst","notebooks/NoUpdates.rst","notebooks/Quadratic.rst","notebooks/Trees.rst","notebooks/Zipper.rst","notebooks/index.rst","parser.rst","pretty.rst","stack.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,""],concat:[3,1,1,""],cons:[3,1,1,""],dip:[3,1,1,""],dipd:[3,1,1,""],dipdd:[3,1,1,""],divmod_:[3,1,1,""],drop:[3,1,1,""],dup:[3,1,1,""],dupd:[3,1,1,""],dupdip:[3,1,1,""],first:[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,""],over:[3,1,1,""],parse:[3,1,1,""],pm:[3,1,1,""],pop:[3,1,1,""],popd:[3,1,1,""],popdd:[3,1,1,""],popop:[3,1,1,""],pred:[3,1,1,""],remove:[3,1,1,""],rest:[3,1,1,""],reverse:[3,1,1,""],rolldown:[3,1,1,""],rollup:[3,1,1,""],select:[3,1,1,""],sharing:[3,1,1,""],shunt:[3,1,1,""],sort_:[3,1,1,""],sqrt:[3,1,1,""],stack_:[3,1,1,""],step:[3,1,1,""],succ:[3,1,1,""],sum_:[3,1,1,""],swaack:[3,1,1,""],swap:[3,1,1,""],take:[3,1,1,""],times:[3,1,1,""],tuck:[3,1,1,""],uncons:[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:[22,4,1,""],Symbol:[22,2,1,""],text_to_expression:[22,1,1,""]},"joy.utils":{pretty_print:[23,0,0,"-"],stack:[24,0,0,"-"]},"joy.utils.pretty_print":{TracePrinter:[23,2,1,""]},"joy.utils.pretty_print.TracePrinter":{go:[23,5,1,""],viewer:[23,5,1,""]},"joy.utils.stack":{expression_to_string:[24,1,1,""],iter_stack:[24,1,1,""],list_to_stack:[24,1,1,""],pick:[24,1,1,""],pushback:[24,1,1,""],stack_to_string:[24,1,1,""]},joy:{joy:[1,0,0,"-"],library:[3,0,0,"-"],parser:[22,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","method","Python method"]},objtypes:{"0":"py:module","1":"py:function","2":"py:class","3":"py:classmethod","4":"py:exception","5":"py:method"},terms:{"0b11100111011011":12,"10m":14,"10n":14,"4ac":18,"5bkei":19,"\u03b5":16,"abstract":[15,19],"boolean":[2,3,15,19],"break":[10,15],"byte":12,"case":[2,3,6,10,14,24],"class":[3,15,22,23,24],"default":[3,9,13,24],"export":[3,22],"final":[2,7,14],"float":[3,15,20,22],"function":[0,1,5,6,7,8,9,11,12,13,17,20,21,22,23,24],"g\u00e9rard":20,"import":[2,4,5,6,7,8,9,10,12,13,14,16,18,19,20],"int":[7,13,14,15,20,22,24],"new":[2,3,4,7,13,14,15,16,17,19],"public":17,"return":[1,3,4,6,7,9,10,12,14,15,16,18,19,22,23,24],"short":18,"static":[2,17],"switch":2,"true":[2,3,6,7,12,14,19],"try":[7,13,14],"void":[0,3],"while":[3,7,9,10,15,22,24],Adding:[15,21],And:[5,7,12,13,14,16,19,20,24],But:[0,4,6,11,12,14,15,19],CPS:15,For:[2,3,5,6,7,8,9,13,14,19,21,24],Going:6,Has:3,Its:3,Not:7,One:[2,15],RHS:19,TOS:[2,3,14],That:[12,14,19],The:[0,1,2,3,5,6,7,8,9,11,13,16,17,18,20,21,22,24],Then:[2,3,6,9,18,19],There:[7,9,14,19,24],These:[21,24],Use:[3,14,16],Using:[7,14,16,19],With:[5,14,16],__str__:23,_within_b:16,_within_p:16,_within_r:16,aaa:8,abbrevi:19,abl:18,about:[0,7,9,15,19,20,24],abov:[0,7,12,16,18,19],abs:[7,16],absolut:[7,15],accept:[1,2,3,12,14,15,16,19,20],access:[7,9],accomplish:18,accordingli:19,accumul:12,across:[7,9],act:16,action:[15,20],actual:[2,7,12,15,19],adapt:21,add:[3,5,6,7,12,13,15,18,23],add_alias:3,add_def:3,add_definit:[3,9,14,19],add_if_match:5,add_valu:9,added:[11,19],adding:[7,17],addit:[0,2,3,9,12,14,15,19],admit:7,advantag:14,after:[5,7,9,12,13,15],afterward:15,again:[2,3,7,9,12,15,16,19],against:[6,7],aggreg:[3,20],aka:[15,20],albrecht:0,algebra:19,algorithm:15,alia:3,alias:[3,15],align:[15,23],all:[3,5,6,12,13,14,15,19,23],alloc:7,allow:[14,17,19],almost:19,along:[14,15,18],alphabet:3,alreadi:[4,7,16,20],also:[0,12,14,15,24],altern:[11,19],although:[5,11,19],altogeth:13,alwai:[7,12,14,17],amort:19,amount:7,analysi:[11,21],anamorph:15,ani:[9,11,12,15,17,19,20,22],annual:15,anonym:19,anoth:[5,14,19,24],answer:7,anyth:[2,3,15],aoc20017:6,aoc20173:7,aoc2017:[5,6,7,8,9,10],api:17,app1:3,app2:[3,4,6,15,18],app3:3,app:15,appear:[2,8,11,12,19],append:9,appli:[2,3,6,12,19],applic:13,approach:[12,18],approxim:21,archiv:0,aren:20,arg:[2,3],argument:[2,3,13,14,15,16,23,24],arithmet:2,ariti:2,around:[12,24],arrai:9,arrang:9,arriv:[13,19],articl:[0,11],ask:[7,11,13],aspect:[0,7],assembl:9,assert:[7,10],assign:24,associ:19,assum:[5,6,8,9,16],asterisk:19,attack:15,attempt:[0,1],attribut:3,automat:[11,14,21],avail:[0,8],averag:[4,15],avoid:19,awar:2,awkward:19,azur:21,back:[7,9,19],backward:[17,19],bag:15,banana:[14,19],bank:10,barb:14,base:[0,2,3,6,10,14,17],basic:[1,2,3,5,7,15,19],bear:9,beat:9,becaus:[2,3,5,6,7,9,14,15,19,20,24],becom:[5,18,19,24],been:[14,16,17,19,20],befor:[6,9,13,14,15,19],begin:[7,14,19],behavior:[17,19],behaviour:[0,1],behind:9,being:0,belong:9,below:[2,3,7,12,13,19,20],bespok:15,best:0,better:[7,12,13,19],between:[0,6,7,12],biannual:15,big:[7,9,19],binari:[0,13,15,19],binary_search_tre:19,binarybuiltinwrapp:3,bind:15,bingo:20,bit:[7,12,13,19],block:[10,12],bodi:[2,15,19],body_text:3,bool:[6,14],borrow:15,both:[2,4,7,9,12,14,15,18,24],bottom:13,boundari:7,bracket:[7,15,22],branch:[3,5,6,9,12,13,19],breakpoint:15,bring:[12,15],btree:21,buck:19,bug:[0,15],build:[14,15,19,20,24],built:[14,18],bundl:[2,3],burgeon:15,calcul:7,calculu:11,call:[2,14,15,16,17,18,23,24],caller:19,came:[9,19],can:[0,2,3,4,5,6,7,11,12,13,14,15,16,17,18,20,21,24],candid:6,captur:15,card:15,care:[7,12,24],carefulli:[19,20],carri:[5,7,14],cartesian:11,categor:[0,18,21],categori:11,ccc:11,ccon:19,ceil:7,certain:[15,24],certainli:19,chang:[2,7,9,17,19,20],charact:20,chat:15,chatter:0,cheat:10,check:[6,13,14],checksum:6,child0:19,childn:19,children:19,choic:[3,14],choos:[17,19],circuit:11,circular:[5,19],cite_not:19,classmethod:3,clear:[3,7,12,15],cleav:[4,5,6,8,15,18],close:[0,1,11],clunki:12,cmp:21,cmp_:19,code:[0,1,11,14,19],collaps:14,collect:[11,13,15],column:7,combin:[0,3,8,12,13,15,16,18,20,21],come:[7,9,15],command:[5,15,18,19],common:[2,12,14],compar:[7,11],comparison:0,compel:11,compil:[2,4,9,11,14,15],complet:11,complex:[3,20],compos:14,compound:19,comput:[2,6,7,9,11,12,15,18],con:[3,6,9,10,12,13,14,15,16,18,20,24],conal:11,concat:[3,5,13,14,15,19],concaten:0,concatin:[0,3,24],concis:7,concret:14,concurr:2,condit:[9,15],condition:6,confid:7,conflict:19,cons2:19,consecut:[13,21],consid:[9,12,13,14,19,20],consist:[2,7,15,19],constant:19,constitu:14,consum:[6,14],contain:[0,2,3,7,8,13,14,15],context:2,continu:[0,6,14,20],control:15,conveni:11,convert:[4,14,19,22,24],cook:14,cool:19,copi:[2,3,5,12,14,19,21],copyright:15,corner:7,correct:7,correctli:19,correspond:11,could:[2,7,9,11,12,14,15,17,19,20],count:[3,7,8,13],count_stat:10,counter:12,cours:[7,9,12,14,19],cover:7,cpu:7,crack:19,crap:21,crash:19,creat:[0,2,3,5,12,13,14,16,19],crude:[19,22],current:[2,3,9,14,15,20,23],custom:17,cycl:[12,13],cython:15,dai:[14,15],data:[2,3,7,21],datastructur:[0,2,14,20,22,24],datatyp:24,ddididi:20,deal:[0,5,19],debugg:14,decid:19,decor:3,decoupl:14,decreas:7,decrement:3,deduc:12,deeper:0,deepli:11,def:[3,4,7,9,10,14,15,18,19,24],defi:3,defin:[2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,20],definit:[2,3,8,9,12,13,14,15,16,17,19,21],definitionwrapp:[3,9,14,19],deleg:15,delet:21,demonstr:[11,14],depend:[14,19],deposit:19,dequot:[5,14],deriv:[2,3,5,6,12,15,16,21],descend:6,describ:[3,11,14,19,22],descript:[12,15,19],design:[2,3,6,19],desir:[7,15,19],destruct:19,detail:[7,15,19],detect:[6,13,14,19],determin:[6,7],develop:[0,13,15,21],diagram:12,dialect:1,dict:[1,3],dictionari:[1,3,15,16,18,19],did:7,didn:14,differ:[0,6,8,11,12,14,16,18,19,24],differenti:11,dig:20,digit:[5,12],dimension:7,dinfrirst:15,dip:[3,4,6,7,9,10,12,13,14,15,16,18,19],dipd:[3,9,13,14,15,18,19,20],dipdd:[3,19],direco:[10,16],direct:15,directli:[7,12,19,24],disappear:2,discard:[3,13,14,16,19],discov:6,disenstacken:[15,19],disk:15,displac:2,distanc:7,distribut:10,ditch:19,div:[3,15],dive:19,divid:6,divis:[6,19],divisor:6,divmod:[3,6],divmod_:3,doc:[2,3,15],document:[21,22,24],doe:[0,1,6,7,9,11,14,15,21,23],doesn:[5,9,12,14,17,19,24],dog:19,doing:[7,11,12,14,15,20],domain:[7,11],don:[6,7,9,12,15,19],done:[2,12,13,15,17],doodl:7,door:15,dot:23,doubl:[12,15],down:[2,3,7,9,16,20],down_to_zero:15,downward:9,dozen:15,draft:[10,11,17],dream:15,drive:13,driven:[12,16],driver:13,drop:[3,5,19],dudipd:15,due:5,dummi:6,dup:[3,5,6,7,9,10,12,13,14,15,16,18,19,20,24],dupd:3,dupdip:[3,6,7,12,14,18,19],duplic:[3,8,14,19],durat:2,dure:[2,14],each:[2,3,4,5,6,7,9,11,12,14,15,19,23],easi:[0,7,19,20],easier:[3,5,19],easili:11,edit:21,effect:[2,3,15,20],effici:[4,7,9,20],either:[1,2,3,6,14,19],eleg:[9,15,18,19],element:[2,3],elliott:11,els:[2,3,5,6,9,10,14],embed:[11,19,20],empti:[3,6,15,24],encapsul:15,enclos:15,encod:[9,13],encount:9,end:[7,9,12,14,24],endless:13,enforc:[2,15],engend:15,enlarg:7,enough:[7,14,15,18,23],enstacken:[13,15],ensur:8,enter:15,entir:24,entri:[3,20,23],epsilon:16,equal:[12,24],equat:[7,15,16],ergo:[7,14,19],err:19,error:[7,15,22],escap:9,essai:0,etc:[3,7,20,22],euler:21,eval:0,evalu:[1,2,3,5,14,15,16,18,19],even:9,evenli:6,eventu:[7,18],everi:13,everyth:[3,19],evolv:17,exactli:14,exampl:[0,3,5,6,7,8,9,12,13,14,16,19,22,24],exce:13,except:[15,19,22],execut:[0,1,2,3,4,6,15,20,24],exist:11,exit:9,expect:[2,3,6,14,19,24],experi:15,experiment:7,explan:15,explor:15,express:[0,1,2,3,4,11,14,19,20,23,24],expression_to_str:24,extend:7,extra:[5,6,12],extrem:15,extrememli:15,facet:0,facil:15,fact:[19,22],factor:[2,12,15,21],fail:[2,3,6,19,22],fals:[2,3,6,10,12,14],far:[9,14,16,19],fascin:0,fast:7,faster:7,favorit:18,fear:19,feel:7,few:[7,12,15],fewer:[3,15],fib:13,fib_gen:13,figur:[2,3,7,19],filter:19,fin:12,find:[2,3,5,6,12,13,19,21],finder:16,fine:[0,12,19],finish:18,first:[3,4,5,6,7,9,10,13,14,15,16,18,19,20,21],fit:[12,15,18],five:[12,14,15],fix:[2,3],flag:6,flatten:[15,19],flexibl:19,floor:[3,7],floordiv:12,flow:15,follow:[0,2,3,6,9,14,15,16,17,20],foo:[15,17,19],foo_ii:17,form:[2,3,6,8,11,12,13,21,24],forman:15,format:[21,23],formula:[0,7,12,21],forth:[5,9,15,19],fortun:9,forum:0,forward:[6,9],found:[9,10,15,19],four:[2,3,7,9,12,13,15,19],fourteen:12,fourth:[2,3,5,19],fractal:15,fraction0:15,fraction:[2,15],framework:15,free:[11,15,19],freeli:[2,7],from:[0,1,2,3,4,5,6,7,8,9,10,12,13,15,16,18,19,20,21,24],front:[2,3],full:[8,12],fun:7,functionwrapp:[3,19],funtion:19,further:[16,21],futur:18,garbag:15,gari:19,gcd:15,gen:10,gener:[2,3,7,9,11,21,24],genrec:[3,6,9,14,15,19],geometr:12,geometri:19,get:[2,6,7,11,12,13,14,15,21],get_valu:9,getitem:3,getrecursionlimit:24,getsourc:15,ghc:11,give:[7,11,12,14,16,24],given:[2,3,5,6,7,9,10,12,13,16,20],glue:15,goal:9,going:[6,7,9,19,20],good:[9,12,19],grab:3,grammar:22,grand:15,graph:7,great:[0,5,7,15,21],greater:[7,24],grid:7,group:[0,7],gsra:16,guard:[6,7],had:[12,20],haiku:15,half:[12,20],half_of_s:5,halfwai:5,hand:[4,15,18,19,21],handi:16,handl:24,happen:[7,15,19],hard:20,hardli:14,hardwar:11,has:[0,2,6,7,9,13,14,15,16,17,19,20,24],haskel:11,have:[2,3,5,6,7,9,10,12,13,14,15,16,17,19,20,21,24],head:[6,14,24],help:[8,14,15,19],help_:3,helper:[3,6],herd:15,here:[7,12,13,14,18,19,20],heterogen:19,heurist:[5,9],hide:19,higher:[15,19],highest:6,highli:[15,19],hindsight:6,histori:23,hmm:19,hog:19,hoist:3,hold:12,hood:9,hope:[0,12,15,21],host:21,how:[0,7,8,9,11,14,19,20],html:[2,3,13,18,21],http:19,huet:20,hugh:[16,19],human:15,hypothet:2,id_:3,idea:[11,12,15,19],ident:[3,14],identifi:7,ift:[3,5,6,9,14,19],ignor:[3,19],illustr:14,imagin:20,immedi:[9,14],immut:[15,19],imper:14,implement:[0,1,2,3,7,10,11,14,15,17,18,19],impli:6,implicit:15,includ:[8,11],inclus:12,incom:24,incompat:17,incr_at:9,incr_step_count:9,incr_valu:9,increas:[7,9,12],increment:[3,11,12,17],index:[0,7,10,15,24],index_of:10,indexerror:24,indic:19,infil:19,infinit:7,inform:3,infra:[3,4,13,14,15,18],infrastructur:3,init:9,init_print:7,initi:[2,3,6,7,8,9,15,16,19],inlin:19,inner:6,input:[1,5,6,7,8,14,16],inscrib:3,inspect:15,instal:0,instanti:[11,23],instead:[7,12,13,14,19,20,24],instruct:9,integ:[2,3,5,6,7,8,9,13,14,15],integr:3,intend:[0,15],interact:[15,21],interest:[0,7,12,13,19],interlock:7,interlud:21,intermedi:14,intern:[0,23,24],interpret:[0,11,14,17,22,23],interrupt:15,interv:[11,12],introduc:17,introduct:0,invari:3,invers:3,investig:18,ipf:15,ipynb:13,isn:[14,20],item:[2,3,5,6,10,14,15,19,24],iter:[1,3,7,14,15,21,24],iter_stack:[4,10,24],its:[0,2,3,6,7,11,12,14,15,19,24],itself:[0,2,9,15,19],j05cmp:[2,3],jenni:19,job:[9,21],john:[16,19],joi:[2,4,5,6,8,9,10,11,16,17,18,19],joypi:[9,10,14,15,19,20],jump:9,jupyt:21,just:[0,2,3,5,6,7,9,13,14,15,17,20],keep:20,kei:21,kevin:0,key_n:19,keyerror:19,kind:[2,7,9,11,14,15,19],kleen:19,know:[7,12,14,19],known:11,labda:11,lambda:[11,14],lambdifi:7,languag:[11,15,17,18,19],larg:7,larger:[7,24],largest:[3,6,9],last:[5,9,12,14],lastli:[13,14],later:[9,15],law:2,lazi:16,lazili:16,lcm:12,lead:[9,15],leaf:19,lean:15,learn:[0,10],least:[2,7,9,12,14,24],least_fract:15,leav:[6,7,9,12,13,19],left:[7,13,14,15,20,23,24],leftov:14,legendari:9,legibl:9,len:10,length:[3,12,24],lens:14,less:[12,13,14,15,24],lesser:7,let:[5,6,7,9,13,14,16,18,19,20],level:[11,19],librari:[0,4,7,9,10,16,18,19],lieu:19,like:[2,3,6,7,10,12,14,15,16,18,22],line:[3,6,9,14,15,19,23],linear:24,link:0,linux:0,list:[0,3,5,6,8,9,10,12,15,16,20,21,23],list_to_stack:[9,10,24],liter:[1,19,20,22],littl:[7,9,19,21],live:21,lkei:19,load:[12,15],locat:[2,7],locu:23,log_2:19,logic:[0,12],longer:19,look:[7,13,15,16,19],lookup:[15,19],loop:[0,1,3,12],lot:[15,18,19,20],love:12,low:11,lower:12,lowest:6,machin:[0,19],machineri:19,macro:15,made:[0,6,15,19,20],mai:[2,9,14,19],mail:0,main:[0,3,5,15,20],mainloop:17,maintain:20,major:17,make:[2,3,4,5,11,12,14,15,20],make_distributor:10,make_gener:16,manfr:[0,2,3,11],manhattan:7,mani:[0,7,8,9,13,14,15],manipul:7,manual:[7,14],map:[1,3,12,14,15,17,18,19],map_:3,mark:[7,9],marker:15,mask:[12,13],match:[0,1,5],materi:0,math:[0,7,9,15,19],mathemat:[7,15],matter:[5,12,14,16,19],max:[6,7,10],max_:3,maximum:[3,19],maxmin:6,mayb:[14,19],maze:9,mean:[6,11,12,14,15,16,19,24],meant:[14,15,18,19],meantim:9,mem:9,member:[2,3,7],memori:7,mental:15,mention:2,mercuri:0,merg:19,meta:[15,19],methink:19,method:[0,3,7,15,21,23],mfloor:7,midpoint:12,might:[5,11,13,14,19],million:13,min:6,min_:3,mind:9,minimum:3,minu:[3,18],mirror:0,miscellan:[0,21],mistak:10,mix:15,mnemon:5,mod:3,model:[11,15],modern:0,modif:13,modifi:[9,15,20],modul:[0,1,3,15,22],modulu:15,monkei:7,month:15,more:[0,3,4,8,9,11,12,13,14,15,16,18,19,22,24],most:19,mostli:0,move:[5,7,9],movement:2,mrank_of:7,much:[7,9,12,14,19],muck:19,mul:[15,18,20,23],multi:3,multipl:[14,21],must:[2,3,6,7,8,12,14,17],mutabl:9,n_kei:19,n_rang:13,n_valu:19,nail:9,name:[1,3,5,15,17,20,21,22,24],natur:[12,13,19],navig:20,need:[2,3,5,6,7,9,10,12,13,14,16,17,19],neg:[3,9,18],nest:[15,19,20],network:15,never:17,newton:[0,21],next:[5,6,7,9,12,14,19],nice:[0,5,7,14,24],niether:2,node:21,non:[6,19],none:[1,3],normal:[8,14],notat:[15,19],note:[2,7,12,16,19,24],notebook:[12,15,20,21],notebook_preambl:[2,4,5,6,7,8,9,10,12,13,14,16,18,19,20],noth:[2,19],notic:12,now:[4,5,6,7,12,13,14,15,21],nth:[3,24],nullari:[6,9,10,15,19],number:[1,2,3,6,12,13,24],object:22,observ:12,obviou:13,obvious:[6,8,9],occur:19,odd:[12,13],off:[2,3,7,12,13,20],offset:9,offset_of:7,old:[2,4],omit:14,onc:[3,8,17,18,19],one:[2,3,5,6,7,8,9,12,13,14,18,19,23,24],ones:13,onli:[2,3,5,6,7,9,12,14,19,20,24],onto:[1,2,3,15,24],open:[8,15],oper:[3,6,14,15,19,24],oppos:5,option:[1,15,24],order:[2,3,5,6,14,15,21,24],org:[0,19],origin:[0,1,2,3,5,19,20],other:[0,2,3,6,7,11,14,15,19,24],otherwis:[3,6,12,13,19],our:[5,6,7,12,13,14,15,16],ourselv:14,out:[2,3,7,11,12,13,14,15,19,20],outcom:19,output:[7,14,16],outsid:[9,11],outward:7,over:[3,5,7,11,12,13,15,16,18,19,21],overhead:7,overkil:14,overshadow:7,own:[7,19],pack:[19,24],packag:[0,15],page:[0,18,19,24],pair:[2,3,5,6,12,13],pair_up:5,palidrom:12,palindrom:12,pam:[15,18],paper:[7,11,14,15,19,20],parallel:2,paramet:[1,2,3,9,14,22,23,24],paranthes:19,parenthes:[9,19,24],pariti:13,pars:[0,3,15,19],parse_definit:3,parseerror:22,parser:0,part:[2,3,6,9,14,16,18,19],partial:[7,14],particular:20,particularli:9,pass:[0,19,23],passphras:8,path:7,pattern:[7,12,19],payoff:14,pe1:[12,13],pe2:13,pearl:20,pend:[3,14,15,20,23],peopl:21,per:[7,15],perform:9,perhap:13,period:15,permit:[9,24],persist:19,phase:2,pick:[12,13,24],pickl:15,pictur:19,piec:14,pip:0,pita:10,place:[3,7,9,12,14,15],plai:0,plain:9,plane:7,plu:[3,7,18],plug:[13,14,19],point:[7,11,14,15,19],pointless:2,pop:[3,4,5,6,9,10,12,13,14,15,18,19,24],popd:[3,4,9,15,16],popdd:[3,6,13,18],popop:[3,5,6,9,10,12,13,14,15,16,19],port:7,posit:[3,9,12,14,15],possibilit:19,possibl:[6,19,21],post:[15,19],potenti:3,power:15,pragmat:12,pre:[9,14,19],preambl:16,precis:[0,1],pred:3,predic:[2,6,13,14],prefer:14,prefix:[14,23],prep:[6,19],prepar:[9,14],preprocessor:14,present:19,preserv:11,pretti:[7,18,19,23,24],pretty_print:0,prevent:14,previou:[7,9,15],prime:[6,16],primit:[2,3,9,18],primrec:[3,6,9,10,13,14,15,16],print:[0,1,2,3,7,14,23,24],probabl:[5,13,15,19],problem:[7,15,21],proc_curr:19,proc_left:19,proc_right:19,proce:[5,12],process:[9,14,15,23],processor:19,produc:[5,12,14,19],product:15,program:[0,2,3,5,6,7,9,13,15,16,20],project:21,prompt:15,proper:[2,3],properli:9,properti:0,provid:[0,3,11,15],prune:19,pun:[0,15],pure:[0,19],puriti:15,purpos:15,push:[2,3,14,15,20,24],pushback:[15,19,24],put:[1,2,13,15,24],puzzl:[5,6,7,8],pypi:0,pyramid:7,python:[0,2,3,7,9,14,18,19,20,22,24],quadrat:[0,7,21],queri:19,queu:14,quit:[0,1,7],quot:[0,3,13,14,15,16,18,19,20,23],quotat:[2,3],quotient:3,rais:[19,22,24],random:9,rang:[7,14,15],range_sum:14,range_to_zero:15,rank_and_offset:7,rank_of:7,raphson:16,rather:[12,14,15,19],ratio:15,reach:[9,12,13,14],read:[0,1,12,13,19,20],readabl:4,real:19,realiz:[5,9,11,19],realli:7,rearrang:[2,14],reason:[7,12,15],rebuild:20,rec1:[2,3],rec2:[2,3],recogn:22,record:[15,23],recur:14,recurs:[2,3,6,9,10,13,15,16,21,24],recus:15,recusr:19,redistribut:[3,15],reduc:2,redund:24,reexamin:19,refactor:[14,15,17],refer:[0,2],regist:2,regular:22,rel:[9,18],releas:17,relev:7,remain:[2,3,15,17],remaind:[3,16],remind:14,remov:[3,7,19,24],renam:19,render:[19,21],repeat:[5,7,12],repeatedli:12,repl:[0,1],replac:[2,3,13,14,20,24],repositori:0,repres:[2,15,19,22,23],represent:24,reprod:13,request:7,requir:[7,24],resembl:15,respect:12,rest:[3,6,10,12,13,15,19,20,21,24],restor:2,result:[1,2,3,6,12,13,14,18,19,20],resum:15,retir:2,retri:15,reus:19,revers:[3,5,6,12,13,14,20,24],rewrit:[9,15],rewritten:15,richard:19,right:[7,13,14,15,23,24],rightmost:12,rkei:19,role:19,roll:[3,6,8,9,14,16,18,19],rolldown:3,rollup:3,root:[3,7,18,21],rotate_seq:5,round:5,row:[6,7],row_valu:7,run:[0,1,3,7,12,14,15,16,19,20],runtim:7,runtimeerror:24,sai:19,same:[2,11,12,14,19,24],sandwich:[2,3],save:[2,12,15],scan:3,scanner:[15,22],scenario:20,scheme:[18,19],scope:[5,19],search:[0,7,19],second:[3,5,6,14,15,19,24],secur:8,see:[0,4,7,13,14,15,17,19,20,23],seem:[0,10,12,15,19],seen:20,select:[3,7],semant:[2,3,15,17,19],semi:15,send:15,sens:[0,2,12,20],separ:15,sequenc:[0,1,2,3,4,5,6,8,9,10,12,15,19,20,22],seri:[7,12,13,14,19,20],serv:14,set:[2,3,14],seven:[12,13],sever:[0,11,15],share:[3,7,15],shelf:2,shift:[12,13],shine:9,shortest:7,should:[2,6,12,14,19],shouldn:15,show:[7,11,19,20],shunt:[3,20],side:19,sign:7,signal:6,signifi:[15,19],silli:19,similar:19,simon:15,simpl:[7,14,15,24],simplefunctionwrapp:[3,4,9,10,18],simplest:21,simpli:11,simplifi:[7,12,19,20],sinc:[2,7,12,18,19],singl:[3,4,13,15,22],situ:19,situat:19,six:[12,13,15],sixti:[12,13],size:[5,8,9,10,15],skeptic:15,skip:[7,9],slight:16,slightli:[14,19],small:[5,19],smallest:[3,6],smart:[9,14],sneaki:7,softwar:15,solei:2,solut:[7,12],solv:7,solvabl:15,some:[2,3,6,7,9,13,14,15,19,21,24],somehow:19,someth:[2,5,9,17],sometim:19,somewher:[14,19,21],sophist:7,sort:[3,6,14,18,19],sort_:3,sourc:[0,1,3,22,23,24],space:[7,12,23],span:12,special:[13,14,19],specif:[0,11],speed:[4,7,9],sphinx:[21,24],spiral:7,spirit:[0,1,19],split_at:5,spreadsheet:6,sqr:[15,18,20],sqrt:[3,7,16,18],squar:[3,7,21,22],stack:[0,1,3,4,6,9,10,12,13,14,16,18,19,20,22,23],stack_:3,stack_to_str:24,stage:19,stai:[0,1],stand:11,standard:15,star:19,stare:19,start:[6,7,9,10,12,13,14,15,16,18,19],state:[6,9,15],step:[3,4,5,6,7,8,12,15,18,19,20],step_zero:[5,6,8],still:[7,9,14],stop:19,storag:[12,14,19],store:[7,12,14],stori:14,str:[1,22,23,24],straightforward:[1,5,7,13],strang:9,stream:[12,16],string:[1,2,3,5,15,20,22,23,24],strip:7,structur:[14,15,19,20,24],stuff:19,style:[0,11],sub:17,subclass:15,subject:20,subract:7,substitut:[7,14],subtract:[6,7,12],succ:3,success:16,suffici:[9,14],suggest:[6,11,19],suitabl:[3,11,12],sum:[3,4,5,6,13,14,15,18,19],sum_:3,summand:12,suppli:[14,19,22],support:[7,15,23,24],sure:[7,14],suspect:2,swaack:[3,4,14,18,19,20],swap:[3,4,5,6,7,8,10,12,13,14,15,16,19,20],swon:[3,10,13,14,15,19,20],swoncat:[9,10,13,14,15,16,19],symbol:[2,3,7,18,20,22],symmetr:12,sympi:18,syntact:15,syntax:[15,24],sys:[7,24],system:[7,8,15,19],tail:[6,19,24],take:[3,5,7,9,12,13,15,16,18,19,24],taken:9,talk:[15,19,24],target:[7,20],task:7,tast:11,tbd:15,technic:2,techniqu:[11,20],technolog:2,teh:19,temporari:20,ten:12,term:[1,2,6,9,10,14,15,16,22,24],termin:[2,3,6],ternari:15,test:[2,3],text:[0,1,3],text_to_express:[15,22],textual:15,than:[0,3,7,8,12,13,15,16,18,24],thei:[2,6,7,12,13,14,15,19,20,22,24],them:[2,3,6,7,12,13,14,19,20,21],theori:[2,3],therefor:[13,19],thi:[0,1,2,3,5,6,7,9,10,11,12,13,14,15,18,20,22,23,24],thing:[2,6,7,9,13,14,18,19,20,22,24],think:[2,9,12,14,15,19],third:[3,5,6,13,15,19],thirti:12,those:[2,3,6,7,9,14,19,21],though:[12,13,19],thought:15,thousand:12,thread:2,three:[2,3,9,12,15,19],through:[1,12,15,20,24],thu:5,thun:[2,3,11,17],thunder:15,tied:19,tile:7,time:[3,7,9,10,12,14,15,19,20],tini:19,to_set:19,todai:15,todo:[15,21,22],togeth:[13,15],token:22,toler:21,tommi:19,too:[14,19],took:7,tool:15,top:[2,3,15,23,24],total:[5,7,12],total_match:5,trace:[0,15,18,20,24],traceprint:23,track:20,tracker:0,trade:7,transform:[11,14],translat:[7,11,14],travers:[20,21],treasur:0,treat:[0,2,3,21],treatment:13,tree:[0,15,21],treemap:14,tri:12,trick:[12,19],tricki:[7,9],trivial:[6,9,19],trobe:0,trove:0,truediv:18,truthi:[3,15],ts0:[14,19],ts1:[14,19],tuck:[3,6,15,19],tupl:[3,15,24],turn:[2,3,7],twice:[7,14,19],two:[2,3,6,7,12,14,15,16,19,20,24],type:[1,11,14,15,21,22,23,24],typic:[2,3],unari:[9,14,15],unarybuiltinwrapp:3,unbalanc:22,uncon:[3,5,6,13,14,15,19,20],under:[2,3,9,15],understand:[0,7,19],undocu:15,unfortun:24,uniqu:[3,8,19],unit:[5,14,15,19],univers:[0,15],unless:[7,14],unlik:14,unnecessari:21,unpack:[2,3,24],unpair:12,unquot:[14,15,19],unstack:3,untangl:[13,14],until:[6,7,9,13],unus:12,unusu:19,updat:[0,21],upward:9,usag:15,use:[0,2,3,4,7,9,11,12,13,15,16,17,18,19,20,24],used:[3,11,14,15,19,20,22,24],useful:0,user:7,uses:[2,6,12,14],using:[3,6,7,13,14,18,19,20],usual:[0,2],util:[0,4,9,10,19],valid:8,valu:[2,3,4,6,7,12,14,15,16,21,24],value_n:19,valueerror:24,vanilla:9,variabl:[14,21],variat:14,varient:19,varieti:[11,15],variou:0,vener:24,verbos:11,veri:[0,1,7,11,15,19,24],versa:2,version:[0,1,2,13,17,18,20,21],via:15,vice:2,view:21,viewer:[1,15,17,23],von:[0,2,3,11],wai:[0,2,3,5,7,9,11,12,14,15,19],walk:19,wall:7,want:[2,7,9,12,13,16,19],warranti:[3,15],wash:15,wast:15,web:24,websit:[0,12],welcom:15,well:[0,5,6,7,11,15,19,22],were:[7,9,14,15,20],what:[2,3,6,9,10,11,14,15,18,19,23],whatev:[2,3,13,19,24],when:[12,13,14,15,16,19,20,22,24],where:[2,3,5,6,9,14,15,19,21,24],whether:14,which:[0,1,3,6,7,9,12,14,15,16,18,19,20,24],whole:[2,3,6,12,19],whose:13,why:[7,16,19],wiki:19,wikipedia:[0,19,20],wildli:15,wind:15,winner:7,wire:14,wit:9,within:[15,19,21],without:[2,15,19],won:[19,24],word:[0,3,5,6,8,12,13,15,19,20],work:[0,5,6,7,9,12,13,14,15,19,20,24],worth:[7,12],would:[2,6,7,8,9,10,12,13,14,15,16,19,20,24],wouldn:9,wrap:[3,7,15],write:[5,7,9,11,13,14,16,19,20,21,24],written:[0,1,4,9,16,18,24],wrong:2,wtf:14,wtfmorphism:14,year:15,yet:[9,14,19,20],yield:[2,3,24],you:[0,2,3,4,6,7,9,12,13,14,15,17,19,20,23,24],your:[2,3,5,6,7,8,15],yourself:[15,19],zero:[3,6,7,9,14,19,22,24],zip:[5,12],zip_:3,zstr:20},titles:["Thun 0.1.1 Documentation","Joy Interpreter","Functions Grouped by, er, Function with Examples","Function Reference","Replacing Functions in the Dictionary","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Advent of Code 2017","Categorical Programming","Developing a Program in Joy","Using x to Generate Values","Hylomorphism","Thun: Joy in Python","Newton\u2019s method","No Updates","Quadratic formula","Treating Trees","Preamble","Essays about Programming in Joy","Parsing Text into Joy Expressions","Tracing Joy Execution","Stack or Quote or Sequence or List\u2026"],titleterms:{"1st":5,"2nd":6,"3rd":7,"4th":8,"5th":9,"6th":10,"case":[16,19],"final":6,"function":[2,3,4,10,14,15,16,18,19],"long":4,"void":2,"while":2,Adding:19,One:13,The:[12,14,15,19],There:15,Use:19,Using:13,about:21,abov:14,add:[2,9,19],adding:19,address:20,advent:[5,6,7,8,9,10],all:[7,9],ana:14,analysi:[7,12],anamorph:[2,14],app1:2,app2:2,app3:2,appendix:14,approxim:16,automat:19,averag:2,base:[16,19],befor:10,better:14,binari:2,block:6,branch:2,breakdown:9,btree:19,can:19,cata:14,catamorph:14,categor:11,chatter:2,check:18,child:19,choic:2,cleanup:18,clear:2,cleav:2,cmp:19,code:[5,6,7,8,9,10,15],combin:[2,14,19],compar:19,comparison:2,compil:13,comput:16,con:[2,19],concat:2,consecut:16,continu:15,count:[9,10],crap:19,current:19,data:19,datastructur:[15,19],decemb:[5,6,7,8,9,10],defin:[18,19],definit:18,delet:19,deriv:[14,18,19],determin:20,develop:12,dialect:0,dictionari:4,dip:[2,20],dipd:2,dipdd:2,direco:13,disenstacken:2,div:2,document:0,doe:19,down:6,down_to_zero:2,drive:10,drop:2,dup:2,dupd:2,dupdip:2,els:19,empti:19,enstacken:2,equal:19,essai:21,euler:[12,13],eval:15,evalu:4,even:13,exampl:[2,15],execut:23,express:[15,22],extract:[14,19],factor:[14,19],factori:14,fibonacci:13,filter:12,find:[7,14,16],first:[2,12],five:13,flatten:2,floordiv:2,form:[14,19],formula:18,four:14,from:14,ftw:5,fun:14,further:12,fusion:14,gcd:2,gener:[10,12,13,14,16,19],genrec:2,get:[9,19],getitem:2,given:[14,19],gotten:9,greater:19,group:2,help:2,host:0,how:[10,12,13],hylo:14,hylomorph:14,ift:2,increment:9,index:9,indic:0,inform:0,infra:[2,19,20],integ:12,interlud:19,intern:22,interpret:[1,15],isn:19,item:20,iter:[12,19],joi:[0,1,3,7,12,14,15,20,21,22,23,24],just:[12,19],kei:19,languag:0,law:14,least_fract:2,left:19,less:19,let:12,librari:[3,15],like:19,list:[2,14,19,24],literari:15,littl:12,logic:2,loop:[2,6,15],lshift:2,make:[16,19],mani:[10,12],map:2,math:2,method:16,min:2,miscellan:[2,19],mod:2,modif:19,modulu:2,mul:2,multipl:[12,13],must:19,name:[18,19],nativ:18,neg:2,newton:16,next:16,node:[14,19],now:[9,19],nullari:2,number:[7,14],offset:7,one:15,onli:15,order:19,osdn:0,our:19,out:6,over:2,pack:12,pam:2,paper:6,para:14,paramet:19,parameter:[14,19],paramorph:14,pars:[2,22],parser:[15,22],pass:15,path:20,pattern:14,per:19,piec:6,pop:2,popd:2,popop:2,pow:2,power:13,preambl:[9,14,20],pred:2,predic:[9,12,16,19],pretty_print:23,primrec:2,print:15,problem:[12,13],process:19,product:2,program:[10,11,12,14,18,19,21],project:[0,12,13],pure:15,put:[7,19],python:[4,15],quadrat:18,quick:0,quot:[2,24],rang:[2,12],range_to_zero:2,rank:7,read:15,recal:10,recur:[16,19],recurs:[14,19],redefin:19,refactor:[5,12,19],refer:3,regular:15,rem:2,remaind:2,remov:2,render:12,repeat:10,repl:15,replac:4,rescu:7,reset:13,rest:[2,14],revers:2,right:[19,20],roll:2,rolldown:2,rollup:2,root:16,rshift:2,run:[2,13],sat:6,second:2,select:2,sequenc:[13,24],set:[9,16,19],shorter:4,should:15,shunt:2,simplest:12,simplifi:18,size:[2,4],slight:19,sqr:2,sqrt:2,squar:16,stack:[2,15,24],start:0,state:10,step:[2,9,14],style:15,sub:2,succ:2,sum:[2,12],swaack:2,swap:2,swon:2,swoncat:2,symbol:[14,15],sympi:7,tabl:0,tail:14,take:2,term:[12,13,19],ternari:2,text:22,than:[14,19],thi:19,think:6,third:2,three:13,thun:[0,15],time:[2,13],todo:19,togeth:[7,9,19],toi:19,token:15,toler:16,trace:[4,23],traceprint:15,travers:19,treat:19,tree:[14,19,20],treestep:[14,19],triangular:14,tricki:6,truediv:2,truthi:2,tuck:2,two:13,type:19,unari:2,uncon:2,unfinish:14,unit:2,unnecessari:12,unquot:2,unstack:2,updat:17,use:14,usual:14,util:[23,24],valu:[9,13,19],variabl:18,version:[4,7,12,19],view:15,want:6,within:16,word:2,write:18,xor:2,zero:13,zip:2,zipper:20}}) \ No newline at end of file diff --git a/docs/sphinx_docs/notebooks/4. Replacing Functions in the Dictionary.rst b/docs/sphinx_docs/notebooks/4. Replacing Functions in the Dictionary.rst index f3d4dd0..76bdad7 100644 --- a/docs/sphinx_docs/notebooks/4. Replacing Functions in the Dictionary.rst +++ b/docs/sphinx_docs/notebooks/4. Replacing Functions in the Dictionary.rst @@ -1,11 +1,13 @@ +************************************* +Replacing Functions in the Dictionary +************************************* -Preamble -~~~~~~~~ .. code:: ipython2 from notebook_preamble import D, J, V + A long trace ~~~~~~~~~~~~ @@ -60,46 +62,23 @@ A long trace 20.5 . -Replacing ``sum`` and ``size`` with "compiled" versions. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Replacing ``size`` with a Python Version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Both ``sum`` and ``size`` are -`catamorphisms `__, they -each convert a sequence to a single value. +Both ``sum`` and ``size`` each convert a sequence to a single value. + +:: + + sum == 0 swap [+] step + size == 0 swap [pop ++] step + + +An efficient ``sum`` function is already in the library. But for ``size`` we can use +a "compiled" version hand-written in Python to speed up evaluation and make the trace more readable. .. code:: ipython2 - J('[sum] help') - - -.. parsed-literal:: - - Given a quoted sequence of numbers return the sum. - - sum == 0 swap [+] step - - - -.. code:: ipython2 - - J('[size] help') - - -.. parsed-literal:: - - 0 swap [pop ++] step - - - -We can use "compiled" versions (they're not really compiled in this -case, they're hand-written in Python) to speed up evaluation and make -the trace more readable. The ``sum`` function is already in the library. -It gets shadowed by the definition version above during -``initialize()``. - -.. code:: ipython2 - - from joy.library import SimpleFunctionWrapper, primitives + from joy.library import SimpleFunctionWrapper from joy.utils.stack import iter_stack @@ -111,17 +90,17 @@ It gets shadowed by the definition version above during for _ in iter_stack(sequence): n += 1 return n, stack - - - sum_ = next(p for p in primitives if p.name == 'sum') -Now we replace them old versions in the dictionary with the new versions +Now we replace the old version in the dictionary with the new version, and re-evaluate the expression. .. code:: ipython2 - old_sum, D['sum'] = D['sum'], sum_ - old_size, D['size'] = D['size'], size + D['size'] = size + + +A Shorter Evaluation +~~~~~~~~~~~~~~~~~~~~ You can see that ``size`` and ``sum`` now execute in a single step. diff --git a/docs/sphinx_docs/notebooks/AlsoNewton.rst b/docs/sphinx_docs/notebooks/AlsoNewton.rst deleted file mode 100644 index 89b5262..0000000 --- a/docs/sphinx_docs/notebooks/AlsoNewton.rst +++ /dev/null @@ -1,195 +0,0 @@ - - - - -A Generator for Approximations -============================== - -In :doc:`Generator Programs` we derive a function ``G`` (called ``make_generator`` in the dictionary) that accepts an initial value and a quoted program and returns a new quoted program that, when driven by the ``x`` combinator (:py:func:`joy.library.x`), acts like a lazy stream. - -To make a generator that generates successive approximations let's start by assuming an initial approximation and then derive the function that computes the next approximation:: - - a F - --------- - a' - - -A Function to Compute the Next Approximation -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Looking at the equation again: - -:math:`a_{i+1} = \frac{(a_i+\frac{n}{a_i})}{2}` - -:: - - a n over / + 2 / - a n a / + 2 / - a n/a + 2 / - a+n/a 2 / - (a+n/a)/2 - -The function we want has the argument ``n`` in it:: - - F == n over / + 2 / - - -Make it into a Generator -^^^^^^^^^^^^^^^^^^^^^^^^ - -Our generator would be created by:: - - a [dup F] make_generator - -With ``n`` as part of the function ``F``, but ``n`` is the input to the ``sqrt`` function we're writing. If we let 1 be the initial approximation:: - - 1 n 1 / + 2 / - 1 n/1 + 2 / - 1 n + 2 / - n+1 2 / - (n+1)/2 - -The generator can be written as:: - - 1 swap [over / + 2 /] cons [dup] swoncat make_generator - -Example:: - - 23 1 swap [over / + 2 /] cons [dup] swoncat make_generator - 1 23 [over / + 2 /] cons [dup] swoncat make_generator - 1 [23 over / + 2 /] [dup] swoncat make_generator - 1 [dup 23 over / + 2 /] make_generator - . - . - . - [1 swap [dup 23 over / + 2 /] direco] - - -A Generator of Square Root Approximations -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:: - - gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator - - -Finding Consecutive Approximations ``within`` a Tolerance -========================================================= - - The remainder of a square root finder is a function *within*, which takes a tolerance and a list of approximations and looks down the list for two successive approximations that differ by no more than the given tolerance. - -From `"Why Functional Programming Matters" by John -Hughes `__ - -(And note that by "list" he means a lazily-evaluated list.) - -Using the *output* ``[a G]`` of the above :doc:`generator ` for square root approximations, and further assuming that the first term ``a`` has been generated already and epsilon ``ε`` is handy on the stack... - -:: - - a [b G] ε within - ---------------------- a b - abs ε <= - b - -:: - - a [b G] ε within - ---------------------- a b - abs ε > - . - [b G] x ε ... - b [c G] ε ... - . - ---------------------- - b [c G] ε within - - - -Predicate -^^^^^^^^^^^^^ - -:: - - a [b G] ε [first - abs] dip <= - a [b G] first - abs ε <= - a b - abs ε <= - a-b abs ε <= - abs(a-b) ε <= - (abs(a-b)<=ε) - - -:: - - P == [first - abs] dip <= - - -Base-Case -^^^^^^^^^^^^^ - -:: - - a [b G] ε roll< popop first - [b G] ε a popop first - [b G] first - b - -:: - - B == roll< popop first - - -Recur -^^^^^^^^^^^^^ - -:: - - a [b G] ε R0 [within] R1 - - -1. Discard ``a``. -2. Use ``x`` combinator to generate next term from ``G``. -3. Run ``within`` with ``i`` (it is a ``primrec`` function.) - -:: - - a [b G] ε R0 [within] R1 - a [b G] ε [popd x] dip [within] i - a [b G] popd x ε [within] i - [b G] x ε [within] i - b [c G] ε [within] i - b [c G] ε within - - b [c G] ε within - -:: - - R0 == [popd x] dip - - -Setting up -^^^^^^^^^^ - -The recursive function we have defined so far needs a slight preamble: ``x`` to prime the generator and the epsilon value to use:: - - [a G] x ε ... - a [b G] ε ... - - -``within`` -^^^^^^^^^^ - -Giving us the following definitions:: - - _within_P == [first - abs] dip <= - _within_B == roll< popop first - _within_R == [popd x] dip - within == x ε [_within_P] [_within_B] [_within_R] primrec - - -Finding Square Roots -==================== - -:: - - sqrt == gsra within - - diff --git a/docs/sphinx_docs/notebooks/Newton-Raphson.rst b/docs/sphinx_docs/notebooks/Newton-Raphson.rst index ead52b2..1686cf7 100644 --- a/docs/sphinx_docs/notebooks/Newton-Raphson.rst +++ b/docs/sphinx_docs/notebooks/Newton-Raphson.rst @@ -1,6 +1,6 @@ - +********************************************************************* `Newton's method `__ -===================================================================== +********************************************************************* Newton-Raphson for finding the root of an equation. @@ -11,193 +11,194 @@ Newton-Raphson for finding the root of an equation. Cf. `"Why Functional Programming Matters" by John Hughes `__ -Finding the Square-Root of a Number -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Let's define a function that computes this equation: +A Generator for Approximations +============================== + +In :doc:`Generator Programs` we derive a function (called ``make_generator`` in the dictionary) that accepts an initial value and a quoted program and returns a new quoted program that, when driven by the ``x`` combinator (:py:func:`joy.library.x`), acts like a lazy stream. + +To make a generator that generates successive approximations let's start by assuming an initial approximation and then derive the function that computes the next approximation:: + + a F + --------- + a' + + +A Function to Compute the Next Approximation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Looking at the equation again: :math:`a_{i+1} = \frac{(a_i+\frac{n}{a_i})}{2}` :: - n a Q - --------------- - (a+n/a)/2 - - n a tuck / + 2 / + a n over / + 2 / a n a / + 2 / a n/a + 2 / a+n/a 2 / (a+n/a)/2 -We want it to leave n but replace a, so we execute it with ``unary``: +The function we want has the argument ``n`` in it:: + + F == n over / + 2 / + + +Make it into a Generator +^^^^^^^^^^^^^^^^^^^^^^^^ + +Our generator would be created by:: + + a [dup F] make_generator + +With ``n`` as part of the function ``F``, but ``n`` is the input to the ``sqrt`` function we're writing. If we let 1 be the initial approximation:: + + 1 n 1 / + 2 / + 1 n/1 + 2 / + 1 n + 2 / + n+1 2 / + (n+1)/2 + +The generator can be written as:: + + 1 swap [over / + 2 /] cons [dup] swoncat make_generator + +Example:: + + 23 1 swap [over / + 2 /] cons [dup] swoncat make_generator + 1 23 [over / + 2 /] cons [dup] swoncat make_generator + 1 [23 over / + 2 /] [dup] swoncat make_generator + 1 [dup 23 over / + 2 /] make_generator + . + . + . + [1 swap [dup 23 over / + 2 /] direco] + + +A Generator of Square Root Approximations +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: - Q == [tuck / + 2 /] unary + gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator -.. code:: ipython2 - define('Q == [tuck / + 2 /] unary') +Finding Consecutive Approximations ``within`` a Tolerance +========================================================= -Compute the Error -^^^^^^^^^^^^^^^^^ + The remainder of a square root finder is a function *within*, which takes a tolerance and a list of approximations and looks down the list for two successive approximations that differ by no more than the given tolerance. -And a function to compute the error: +From `"Why Functional Programming Matters" by John +Hughes `__ + +(And note that by "list" he means a lazily-evaluated list.) + +Using the *output* ``[a G]`` of the above :doc:`generator ` for square root approximations, and further assuming that the first term ``a`` has been generated already and epsilon ``ε`` is handy on the stack... :: - n a sqr - abs - |n-a**2| - -This should be ``nullary`` so as to leave both n and a on the stack -below the error. + a [b G] ε within + ---------------------- a b - abs ε <= + b :: - err == [sqr - abs] nullary + a [b G] ε within + ---------------------- a b - abs ε > + . + [b G] x ε ... + b [c G] ε ... + . + ---------------------- + b [c G] ε within -.. code:: ipython2 - define('err == [sqr - abs] nullary') -``square-root`` -^^^^^^^^^^^^^^^ - -Now we can define a recursive program that expects a number ``n``, an -initial estimate ``a``, and an epsilon value ``ε``, and that leaves on -the stack the square root of ``n`` to within the precision of the -epsilon value. (Later on we'll refine it to generate the initial -estimate and hard-code an epsilon value.) +Predicate +^^^^^^^^^^^^^ :: - n a ε square-root - ----------------- - √n + a [b G] ε [first - abs] dip <= + a [b G] first - abs ε <= + a b - abs ε <= + a-b abs ε <= + abs(a-b) ε <= + (abs(a-b)<=ε) -If we apply the two functions ``Q`` and ``err`` defined above we get the -next approximation and the error on the stack below the epsilon. :: - n a ε [Q err] dip - n a Q err ε - n a' err ε - n a' e ε + P == [first - abs] dip <= -Let's define a recursive function ``K`` from here. + +Base-Case +^^^^^^^^^^^^^ :: - n a' e ε K - - K == [P] [E] [R0] [R1] genrec - -Base-case -~~~~~~~~~ - -The predicate and the base case are obvious: + a [b G] ε roll< popop first + [b G] ε a popop first + [b G] first + b :: - K == [<] [popop popd] [R0] [R1] genrec + B == roll< popop first -:: - - n a' e ε popop popd - n a' popd - a' Recur -~~~~~~~~~~ - -The recursive branch is pretty easy. Discard the error and recur. +^^^^^^^^^^^^^ :: - K == [<] [popop popd] [R0] [R1] genrec - K == [<] [popop popd] [R0 [K] R1] ifte + a [b G] ε R0 [within] R1 + + +1. Discard ``a``. +2. Use ``x`` combinator to generate next term from ``G``. +3. Run ``within`` with ``i`` (it is a ``primrec`` function.) :: - n a' e ε R0 [K] R1 - n a' e ε popd [Q err] dip [K] i - n a' ε [Q err] dip [K] i - n a' Q err ε [K] i - n a'' e ε K + a [b G] ε R0 [within] R1 + a [b G] ε [popd x] dip [within] i + a [b G] popd x ε [within] i + [b G] x ε [within] i + b [c G] ε [within] i + b [c G] ε within -This fragment alone is pretty useful. (``R1`` is ``i`` so this is a ``primrec`` "primitive recursive" function.) - -.. code:: ipython2 - - define('K == [<] [popop popd] [popd [Q err] dip] primrec') - -.. code:: ipython2 - - J('25 10 0.001 dup K') - - -.. parsed-literal:: - - 5.000000232305737 - - -.. code:: ipython2 - - J('25 10 0.000001 dup K') - - -.. parsed-literal:: - - 5.000000000000005 - -Initial Approximation and Epsilon -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -So now all we need is a way to generate an initial approximation and an -epsilon value: + b [c G] ε within :: - square-root == dup 3 / 0.000001 dup K - -.. code:: ipython2 - - define('square-root == dup 3 / 0.000001 dup K') - -Examples -~~~~~~~~~~ - -.. code:: ipython2 - - J('36 square-root') + R0 == [popd x] dip -.. parsed-literal:: +Setting up +^^^^^^^^^^ - 6.000000000000007 +The recursive function we have defined so far needs a slight preamble: ``x`` to prime the generator and the epsilon value to use:: + + [a G] x ε ... + a [b G] ε ... -.. code:: ipython2 +``within`` +^^^^^^^^^^ - J('4895048365636 square-root') +Giving us the following definitions:: + + _within_P == [first - abs] dip <= + _within_B == roll< popop first + _within_R == [popd x] dip + within == x ε [_within_P] [_within_B] [_within_R] primrec -.. parsed-literal:: +Finding Square Roots +==================== - 2212475.6192184356 - - -.. code:: ipython2 - - 2212475.6192184356 * 2212475.6192184356 - - - - -.. parsed-literal:: - - 4895048365636.0 +:: + sqrt == gsra within