diff --git a/docs/3._Developing_a_Program.ipynb b/docs/3._Developing_a_Program.ipynb index 0cb1730..cf3a23d 100644 --- a/docs/3._Developing_a_Program.ipynb +++ b/docs/3._Developing_a_Program.ipynb @@ -157,7 +157,7 @@ "cell_type": "code", "execution_count": 6, "metadata": { - "scrolled": true + "scrolled": false }, "outputs": [ { @@ -1113,7 +1113,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", - "version": "2.7.13" + "version": "2.7.12" } }, "nbformat": 4, diff --git a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.html b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.html index 8bc2a6b..c927ed0 100644 --- a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.html +++ b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.html @@ -12526,7 +12526,7 @@ range_sum == [0 <=] [pop 0] [1 - dup] [dip +] genrec
-
In [8]:
+
In [10]:
defs = '''
@@ -12548,7 +12548,7 @@ range_sum == [0 <=] [pop 0] [1 - dup] [dip +] genrec
-
In [9]:
+
In [11]:
J('10 range')
@@ -12579,7 +12579,7 @@ range_sum == [0 <=] [pop 0] [1 - dup] [dip +] genrec
-
In [10]:
+
In [12]:
J('[9 8 7 6 5 4 3 2 1 0] sum')
@@ -12610,7 +12610,7 @@ range_sum == [0 <=] [pop 0] [1 - dup] [dip +] genrec
-
In [11]:
+
In [13]:
V('10 range sum')
@@ -13127,7 +13127,7 @@ range_sum == [0 <=] [pop 0] [1 - dup] [dip +] genrec
-
In [12]:
+
In [14]:
V('10 range_sum')
@@ -14390,789 +14390,6 @@ False [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 2] . swaac
 
 
-
-
-
-
-
-

Tree with node and list of trees.

-
tree = [] | [node [tree*]]
- -
-
-
-
-
-
-
-

treestep

-
tree z [C] [N] treestep
-
-
-   [] z [C] [N] treestep
----------------------------
-      z
-
-
-   [node [tree*]] z [C] [N] treestep
---------------------------------------- w/ K == z [C] [N] treestep
-       node N [tree*] [K] map C
- -
-
-
-
-
-
-
-

Derive the recursive form.

-
K == [not] [pop z] [J] ifte
-
-
-       [node [tree*]] J
-------------------------------
-   node N [tree*] [K] map C
-
-
-J == .. [N] .. [K] .. [C] ..
-
-[node [tree*]] uncons [N] dip
-node [[tree*]]        [N] dip
-node N [[tree*]]
-
-node N [[tree*]] i [K] map
-node N  [tree*]    [K] map
-node N  [K.tree*]
-
-J == uncons [N] dip i [K] map [C] i
-
-K == [not] [pop z] [uncons [N] dip i [K] map [C] i] ifte
-K == [not] [pop z] [uncons [N] dip i]   [map [C] i] genrec
- -
-
-
-
-
-
-
-

Extract the givens to parameterize the program.

-
[not] [pop z]                   [uncons [N] dip unquote] [map [C] i] genrec
-[not] [z]         [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec
-[not]  z     unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec
-z [not] swap unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec
-  \............TS0............/
-z TS0 [uncons [N] dip unquote]                      [map [C] i] genrec
-z [uncons [N] dip unquote]                [TS0] dip [map [C] i] genrec
-z [[N] dip unquote]      [uncons] swoncat [TS0] dip [map [C] i] genrec
-z [N] [dip unquote] cons [uncons] swoncat [TS0] dip [map [C] i] genrec
-      \...........TS1.................../
-z [N] TS1 [TS0] dip [map [C] i]                       genrec
-z [N]               [map [C] i]            [TS1 [TS0] dip] dip      genrec
-z [N]               [map  C   ]            [TS1 [TS0] dip] dip      genrec
-z [N]                    [C] [map] swoncat [TS1 [TS0] dip] dip genrec
-z [C] [N] swap               [map] swoncat [TS1 [TS0] dip] dip genrec
- -
-
-
-
-
-
-
- -
     TS0 == [not] swap unit [pop] swoncat
-     TS1 == [dip i] cons [uncons] swoncat
-treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec
- -
-
-
-
-
-
-
- -
   [] 0 [C] [N] treestep
----------------------------
-      0
-
-
-      [n [tree*]] 0 [sum +] [] treestep
-   --------------------------------------------------
-       n [tree*] [0 [sum +] [] treestep] map sum +
- -
-
-
-
-
-
In [40]:
-
-
-
DefinitionWrapper.add_definitions('''
-
-     TS0 == [not] swap unit [pop] swoncat
-     TS1 == [dip i] cons [uncons] swoncat
-treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec
-
-''', D)
-
- -
-
-
- -
-
-
-
In [31]:
-
-
-
V('[] 0 [sum +] [] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
                                                                                                       . [] 0 [sum +] [] treestep
-                                                                                                    [] . 0 [sum +] [] treestep
-                                                                                                  [] 0 . [sum +] [] treestep
-                                                                                          [] 0 [sum +] . [] treestep
-                                                                                       [] 0 [sum +] [] . treestep
-                                                                                       [] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec
-                                                                                       [] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec
-                                                                                 [] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec
-                                                                                 [] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec
-                                                                                 [] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec
-                                                                                   [] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec
-                                                                   [] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec
-                                                                                               [] 0 [] . TS1 [TS0] dip [map sum +] genrec
-                                                                                               [] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                       [] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                       [] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                              [] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec
-                                                                              [] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec
-                                                                              [] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec
-                                                                                [] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec
-                                                                          [] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec
-                                                                                                  [] 0 . TS0 [uncons [] dip i] [map sum +] genrec
-                                                                                                  [] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                            [] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                            [] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                            [] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                         [] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                          [] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                    [] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                    [] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec
-                                                                                    [] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec
-                                                                                      [] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec
-                                                                    [] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec
-                                                        [] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec
-     [] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte
-[] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[]] [not] . infra first choice i
-                                                                                                    [] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i
-                                                                                                  True . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i
-    True [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] . swaack first choice i
-    [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [True] . first choice i
-      [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] True . choice i
-                                                                                            [] [pop 0] . i
-                                                                                                    [] . pop 0
-                                                                                                       . 0
-                                                                                                     0 . 
-
-
-
- -
-
- -
-
-
-
In [32]:
-
-
-
V('[23 []] 0 [sum +] [] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
                                                                                                                 . [23 []] 0 [sum +] [] treestep
-                                                                                                         [23 []] . 0 [sum +] [] treestep
-                                                                                                       [23 []] 0 . [sum +] [] treestep
-                                                                                               [23 []] 0 [sum +] . [] treestep
-                                                                                            [23 []] 0 [sum +] [] . treestep
-                                                                                            [23 []] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec
-                                                                                            [23 []] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec
-                                                                                      [23 []] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec
-                                                                                      [23 []] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec
-                                                                                      [23 []] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec
-                                                                                        [23 []] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec
-                                                                        [23 []] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec
-                                                                                                    [23 []] 0 [] . TS1 [TS0] dip [map sum +] genrec
-                                                                                                    [23 []] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                            [23 []] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                            [23 []] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                   [23 []] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec
-                                                                                   [23 []] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec
-                                                                                   [23 []] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec
-                                                                                     [23 []] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec
-                                                                               [23 []] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec
-                                                                                                       [23 []] 0 . TS0 [uncons [] dip i] [map sum +] genrec
-                                                                                                       [23 []] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                 [23 []] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                 [23 []] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                 [23 []] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                              [23 []] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                               [23 []] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                         [23 []] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                         [23 []] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec
-                                                                                         [23 []] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec
-                                                                                           [23 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec
-                                                                         [23 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec
-                                                             [23 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec
-          [23 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte
-[23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 []]] [not] . infra first choice i
-                                                                                                         [23 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i
-                                                                                                           False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i
-        False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] . swaack first choice i
-        [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i
-          [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i
-                        [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i
-                                                                                                         [23 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                         23 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                      23 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                              23 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                         23 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                              23 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                           23 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                      23 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum +
-                                                                                                           23 [] . sum +
-                                                                                                           23 [] . 0 [+] catamorphism +
-                                                                                                         23 [] 0 . [+] catamorphism +
-                                                                                                     23 [] 0 [+] . catamorphism +
-                                                                                                     23 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism +
-                                                                                              23 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism +
-                                                                                              23 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism +
-                                                                                23 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism +
-                                                                                23 [] [[] =] 0 [uncons swap] [+] . hylomorphism +
-                                                                                23 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec +
-                                                           23 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec +
-                                                                                                  23 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                  23 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                               23 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                23 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                          23 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                          23 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                          23 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                            23 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec +
-                                                                              23 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec +
-                                                                          23 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec +
-                                                                    23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec +
-                                                                    23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec +
-                                                                    23 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec +
-                                                                      23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec +
-                          23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte +
-                  23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i +
-                                                                                                           23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i +
-                                                                                                        23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i +
-                                                                                                         23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i +
-                       23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i +
-                       23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i +
-                            23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i +
-                                                                                                   23 [] [pop 0] . i +
-                                                                                                           23 [] . pop 0 +
-                                                                                                              23 . 0 +
-                                                                                                            23 0 . +
-                                                                                                              23 . 
-
-
-
- -
-
- -
-
-
-
In [33]:
-
-
-
V('[23 [[2 []] [3 []]]] 0 [sum +] [] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
                                                                                                                                                                  . [23 [[2 []] [3 []]]] 0 [sum +] [] treestep
-                                                                                                                                             [23 [[2 []] [3 []]]] . 0 [sum +] [] treestep
-                                                                                                                                           [23 [[2 []] [3 []]]] 0 . [sum +] [] treestep
-                                                                                                                                   [23 [[2 []] [3 []]]] 0 [sum +] . [] treestep
-                                                                                                                                [23 [[2 []] [3 []]]] 0 [sum +] [] . treestep
-                                                                                                                                [23 [[2 []] [3 []]]] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec
-                                                                                                                                [23 [[2 []] [3 []]]] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec
-                                                                                                                          [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec
-                                                                                                                          [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec
-                                                                                                                          [23 [[2 []] [3 []]]] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec
-                                                                                                                            [23 [[2 []] [3 []]]] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec
-                                                                                                            [23 [[2 []] [3 []]]] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec
-                                                                                                                                        [23 [[2 []] [3 []]]] 0 [] . TS1 [TS0] dip [map sum +] genrec
-                                                                                                                                        [23 [[2 []] [3 []]]] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                                                                [23 [[2 []] [3 []]]] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                                                                [23 [[2 []] [3 []]]] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec
-                                                                                                                       [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec
-                                                                                                                       [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec
-                                                                                                                       [23 [[2 []] [3 []]]] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec
-                                                                                                                         [23 [[2 []] [3 []]]] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec
-                                                                                                                   [23 [[2 []] [3 []]]] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec
-                                                                                                                                           [23 [[2 []] [3 []]]] 0 . TS0 [uncons [] dip i] [map sum +] genrec
-                                                                                                                                           [23 [[2 []] [3 []]]] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                                     [23 [[2 []] [3 []]]] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                                     [23 [[2 []] [3 []]]] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                                     [23 [[2 []] [3 []]]] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                                  [23 [[2 []] [3 []]]] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                                   [23 [[2 []] [3 []]]] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                             [23 [[2 []] [3 []]]] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec
-                                                                                                                             [23 [[2 []] [3 []]]] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec
-                                                                                                                             [23 [[2 []] [3 []]]] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec
-                                                                                                                               [23 [[2 []] [3 []]]] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec
-                                                                                                             [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec
-                                                                                                 [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec
-                                              [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte
-                       [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 [[2 []] [3 []]]]] [not] . infra first choice i
-                                                                                                                                             [23 [[2 []] [3 []]]] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i
-                                                                                                                                                            False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i
-                                            False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] . swaack first choice i
-                                            [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i
-                                              [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i
-                                                            [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i
-                                                                                                                                             [23 [[2 []] [3 []]]] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                                                             23 [[[2 []] [3 []]]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                                                          23 [[[2 []] [3 []]]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                                                                               23 . [[[2 []] [3 []]]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                                                             23 [[[2 []] [3 []]]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                                                                               23 . [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                                                                               23 [[2 []] [3 []]] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +
-                                                                                          23 [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum +
-23 [] [[[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first] . infra sum +
-                                                                                                                                                                  . [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                      [[3 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                 [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 [3 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                  23 [3 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                          23 [3 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                        23 [3 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                            23 [3 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                         23 [3 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                             23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[3 []] 23] [not] . infra first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 [3 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                         23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                    23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] . swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                    23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                         23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                       23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 [3 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 3 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                     23 3 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                             23 3 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 3 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                             23 3 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                          23 3 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                     23 3 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                          23 3 [] . sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                          23 3 [] . 0 [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 3 [] 0 . [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                    23 3 [] 0 [+] . catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                    23 3 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                             23 3 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                             23 3 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                               23 3 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                               23 3 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                               23 3 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                          23 3 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                 23 3 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                 23 3 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                              23 3 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                               23 3 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                         23 3 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                         23 3 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                         23 3 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                           23 3 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                             23 3 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                         23 3 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                   23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                   23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                   23 3 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                     23 3 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                         23 3 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                               23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 3 23] [[] =] . infra first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                          23 3 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                       23 3 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                        23 3 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                    23 3 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] . swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                    23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 3 23] . first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                           23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                  23 3 [] [pop 0] . i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                          23 3 [] . pop 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                             23 3 . 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                           23 3 0 . + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                             23 3 . [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                          23 3 [] . swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                           [3 23] . first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                                3 . [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                                                                                    3 [[2 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +
-                                                                                               3 [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [23] swaack sum +
-                                                                                                                                                        23 [2 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum +
-                                                                                                                                                  23 [2 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum +
-                                                                                                                                          23 [2 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum +
-                                                                                                                        23 [2 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [3] swaack first [23] swaack sum +
-                                                                                                            23 [2 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [3] swaack first [23] swaack sum +
-                                                         23 [2 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [3] swaack first [23] swaack sum +
-                                             23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[2 []] 23] [not] . infra first choice i [3] swaack first [23] swaack sum +
-                                                                                                                                                        23 [2 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum +
-                                                                                                                                                         23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum +
-                                                    23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] . swaack first choice i [3] swaack first [23] swaack sum +
-                                                    23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [3] swaack first [23] swaack sum +
-                                                         23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [3] swaack first [23] swaack sum +
-                                                                       23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [3] swaack first [23] swaack sum +
-                                                                                                                                                        23 [2 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                        23 2 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                     23 2 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                             23 2 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                        23 2 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                             23 2 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                          23 2 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +
-                                                                                                     23 2 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                          23 2 [] . sum + [3] swaack first [23] swaack sum +
-                                                                                                                                                          23 2 [] . 0 [+] catamorphism + [3] swaack first [23] swaack sum +
-                                                                                                                                                        23 2 [] 0 . [+] catamorphism + [3] swaack first [23] swaack sum +
-                                                                                                                                                    23 2 [] 0 [+] . catamorphism + [3] swaack first [23] swaack sum +
-                                                                                                                                                    23 2 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum +
-                                                                                                                                             23 2 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum +
-                                                                                                                                             23 2 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum +
-                                                                                                                               23 2 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [3] swaack first [23] swaack sum +
-                                                                                                                               23 2 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [3] swaack first [23] swaack sum +
-                                                                                                                               23 2 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                          23 2 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                                 23 2 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                                 23 2 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                              23 2 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                               23 2 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                         23 2 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                         23 2 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                         23 2 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                                           23 2 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                             23 2 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                         23 2 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                   23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                   23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                   23 2 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [3] swaack first [23] swaack sum +
-                                                                                                                     23 2 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [3] swaack first [23] swaack sum +
-                                                                         23 2 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [3] swaack first [23] swaack sum +
-                                                               23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 2 23] [[] =] . infra first choice i + [3] swaack first [23] swaack sum +
-                                                                                                                                                          23 2 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum +
-                                                                                                                                                       23 2 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum +
-                                                                                                                                                        23 2 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum +
-                                                                    23 2 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] . swaack first choice i + [3] swaack first [23] swaack sum +
-                                                                    23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 2 23] . first choice i + [3] swaack first [23] swaack sum +
-                                                                           23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [3] swaack first [23] swaack sum +
-                                                                                                                                                  23 2 [] [pop 0] . i + [3] swaack first [23] swaack sum +
-                                                                                                                                                          23 2 [] . pop 0 + [3] swaack first [23] swaack sum +
-                                                                                                                                                             23 2 . 0 + [3] swaack first [23] swaack sum +
-                                                                                                                                                           23 2 0 . + [3] swaack first [23] swaack sum +
-                                                                                                                                                             23 2 . [3] swaack first [23] swaack sum +
-                                                                                                                                                         23 2 [3] . swaack first [23] swaack sum +
-                                                                                                                                                         3 [2 23] . first [23] swaack sum +
-                                                                                                                                                              3 2 . [23] swaack sum +
-                                                                                                                                                         3 2 [23] . swaack sum +
-                                                                                                                                                         23 [2 3] . sum +
-                                                                                                                                                         23 [2 3] . 0 [+] catamorphism +
-                                                                                                                                                       23 [2 3] 0 . [+] catamorphism +
-                                                                                                                                                   23 [2 3] 0 [+] . catamorphism +
-                                                                                                                                                   23 [2 3] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism +
-                                                                                                                                            23 [2 3] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism +
-                                                                                                                                            23 [2 3] [[] =] 0 [+] . [uncons swap] swap hylomorphism +
-                                                                                                                              23 [2 3] [[] =] 0 [+] [uncons swap] . swap hylomorphism +
-                                                                                                                              23 [2 3] [[] =] 0 [uncons swap] [+] . hylomorphism +
-                                                                                                                              23 [2 3] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec +
-                                                                                                         23 [2 3] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec +
-                                                                                                                                                23 [2 3] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                                23 [2 3] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                             23 [2 3] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                              23 [2 3] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                        23 [2 3] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                        23 [2 3] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                        23 [2 3] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                                          23 [2 3] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec +
-                                                                                                                            23 [2 3] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec +
-                                                                                                                        23 [2 3] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec +
-                                                                                                                  23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec +
-                                                                                                                  23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec +
-                                                                                                                  23 [2 3] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec +
-                                                                                                                    23 [2 3] [[] =] [pop 0] [uncons swap] [dip +] . genrec +
-                                                                        23 [2 3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte +
-                                                             23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[2 3] 23] [[] =] . infra first choice i +
-                                                                                                                                                         23 [2 3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i +
-                                                                                                                                                      23 [2 3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i +
-                                                                                                                                                         23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i +
-                                                                    23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] . swaack first choice i +
-                                                                    23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i +
-                                                                         23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i +
-                                                                                       23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i +
-                                                                                                                                                         23 [2 3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + +
-                                                                                                                                                         23 2 [3] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + +
-                                                                                                                                                         23 [3] 2 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + +
-                                                                                                           23 [3] 2 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + +
-                                                                                                                                                           23 [3] . [[] =] [pop 0] [uncons swap] [dip +] genrec 2 + +
-                                                                                                                                                    23 [3] [[] =] . [pop 0] [uncons swap] [dip +] genrec 2 + +
-                                                                                                                                            23 [3] [[] =] [pop 0] . [uncons swap] [dip +] genrec 2 + +
-                                                                                                                              23 [3] [[] =] [pop 0] [uncons swap] . [dip +] genrec 2 + +
-                                                                                                                      23 [3] [[] =] [pop 0] [uncons swap] [dip +] . genrec 2 + +
-                                                                          23 [3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 2 + +
-                                                                 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[3] 23] [[] =] . infra first choice i 2 + +
-                                                                                                                                                           23 [3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + +
-                                                                                                                                                        23 [3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + +
-                                                                                                                                                         23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + +
-                                                                      23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] . swaack first choice i 2 + +
-                                                                      23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i 2 + +
-                                                                           23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 2 + +
-                                                                                         23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 2 + +
-                                                                                                                                                           23 [3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + +
-                                                                                                                                                          23 3 [] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + +
-                                                                                                                                                          23 [] 3 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + +
-                                                                                                            23 [] 3 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 2 + +
-                                                                                                                                                            23 [] . [[] =] [pop 0] [uncons swap] [dip +] genrec 3 + 2 + +
-                                                                                                                                                     23 [] [[] =] . [pop 0] [uncons swap] [dip +] genrec 3 + 2 + +
-                                                                                                                                             23 [] [[] =] [pop 0] . [uncons swap] [dip +] genrec 3 + 2 + +
-                                                                                                                               23 [] [[] =] [pop 0] [uncons swap] . [dip +] genrec 3 + 2 + +
-                                                                                                                       23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec 3 + 2 + +
-                                                                           23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 3 + 2 + +
-                                                                   23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i 3 + 2 + +
-                                                                                                                                                            23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + +
-                                                                                                                                                         23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + +
-                                                                                                                                                          23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + +
-                                                                        23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i 3 + 2 + +
-                                                                        23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i 3 + 2 + +
-                                                                             23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i 3 + 2 + +
-                                                                                                                                                    23 [] [pop 0] . i 3 + 2 + +
-                                                                                                                                                            23 [] . pop 0 3 + 2 + +
-                                                                                                                                                               23 . 0 3 + 2 + +
-                                                                                                                                                             23 0 . 3 + 2 + +
-                                                                                                                                                           23 0 3 . + 2 + +
-                                                                                                                                                             23 3 . 2 + +
-                                                                                                                                                           23 3 2 . + +
-                                                                                                                                                             23 5 . +
-                                                                                                                                                               28 . 
-
-
-
- -
-
- -
-
-
-
In [34]:
-
-
-
J('[23 [[2 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]] [3 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]]]] 0 [sum +] [] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
140
-
-
-
- -
-
- -
-
-
-
In [35]:
-
-
-
J('[] [] [unit cons] [23 +] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
[]
-
-
-
- -
-
- -
-
-
-
In [36]:
-
-
-
J('[23 []] [] [unit cons] [23 +] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
[46 []]
-
-
-
- -
-
- -
-
-
-
In [37]:
-
-
-
J('[23 [[2 []] [3 []]]] [] [unit cons] [23 +] treestep')
-
- -
-
-
- -
-
- - -
- -
- - -
-
[46 [[25 []] [26 []]]]
-
-
-
- -
-
- -
-
-
-
In [38]:
-
-
-
define('treemap == [] [unit cons] roll< treestep')
-
- -
-
-
- -
-
-
-
In [39]:
-
-
-
J('[23 [[2 []] [3 []]]] [23 +] treemap')
-
- -
-
-
- -
-
- - -
- -
- - -
-
[46 [[25 []] [26 []]]]
-
-
-
- -
-
-
diff --git a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.ipynb b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.ipynb index fde17ad..f7d7293 100644 --- a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.ipynb +++ b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.ipynb @@ -273,9 +273,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -642,7 +640,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -660,7 +658,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -677,7 +675,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -694,10 +692,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": true - }, + "execution_count": 13, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1199,10 +1195,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": true - }, + "execution_count": 14, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1906,9 +1900,7 @@ { "cell_type": "code", "execution_count": 26, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -2008,9 +2000,7 @@ { "cell_type": "code", "execution_count": 27, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -2092,9 +2082,7 @@ { "cell_type": "code", "execution_count": 28, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -2177,9 +2165,7 @@ { "cell_type": "code", "execution_count": 29, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -2269,698 +2255,6 @@ "\n", "\"Too much is always better than not enough.\"" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Tree with node and list of trees.\n", - "\n", - " tree = [] | [node [tree*]]" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### `treestep`\n", - "\n", - " tree z [C] [N] treestep\n", - "\n", - "\n", - " [] z [C] [N] treestep\n", - " ---------------------------\n", - " z\n", - "\n", - "\n", - " [node [tree*]] z [C] [N] treestep\n", - " --------------------------------------- w/ K == z [C] [N] treestep\n", - " node N [tree*] [K] map C" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Derive the recursive form.\n", - " K == [not] [pop z] [J] ifte\n", - "\n", - "\n", - " [node [tree*]] J\n", - " ------------------------------\n", - " node N [tree*] [K] map C\n", - "\n", - "\n", - " J == .. [N] .. [K] .. [C] ..\n", - "\n", - " [node [tree*]] uncons [N] dip\n", - " node [[tree*]] [N] dip\n", - " node N [[tree*]]\n", - "\n", - " node N [[tree*]] i [K] map\n", - " node N [tree*] [K] map\n", - " node N [K.tree*]\n", - "\n", - " J == uncons [N] dip i [K] map [C] i\n", - "\n", - " K == [not] [pop z] [uncons [N] dip i [K] map [C] i] ifte\n", - " K == [not] [pop z] [uncons [N] dip i] [map [C] i] genrec" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Extract the givens to parameterize the program.\n", - " [not] [pop z] [uncons [N] dip unquote] [map [C] i] genrec\n", - " [not] [z] [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec\n", - " [not] z unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec\n", - " z [not] swap unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec\n", - " \\............TS0............/\n", - " z TS0 [uncons [N] dip unquote] [map [C] i] genrec\n", - " z [uncons [N] dip unquote] [TS0] dip [map [C] i] genrec\n", - " z [[N] dip unquote] [uncons] swoncat [TS0] dip [map [C] i] genrec\n", - " z [N] [dip unquote] cons [uncons] swoncat [TS0] dip [map [C] i] genrec\n", - " \\...........TS1.................../\n", - " z [N] TS1 [TS0] dip [map [C] i] genrec\n", - " z [N] [map [C] i] [TS1 [TS0] dip] dip genrec\n", - " z [N] [map C ] [TS1 [TS0] dip] dip genrec\n", - " z [N] [C] [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " z [C] [N] swap [map] swoncat [TS1 [TS0] dip] dip genrec" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " TS0 == [not] swap unit [pop] swoncat\n", - " TS1 == [dip i] cons [uncons] swoncat\n", - " treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - " [] 0 [C] [N] treestep\n", - " ---------------------------\n", - " 0\n", - "\n", - "\n", - " [n [tree*]] 0 [sum +] [] treestep\n", - " --------------------------------------------------\n", - " n [tree*] [0 [sum +] [] treestep] map sum +" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [], - "source": [ - "DefinitionWrapper.add_definitions('''\n", - "\n", - " TS0 == [not] swap unit [pop] swoncat\n", - " TS1 == [dip i] cons [uncons] swoncat\n", - "treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec\n", - "\n", - "''', D)" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": { - "collapsed": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " . [] 0 [sum +] [] treestep\n", - " [] . 0 [sum +] [] treestep\n", - " [] 0 . [sum +] [] treestep\n", - " [] 0 [sum +] . [] treestep\n", - " [] 0 [sum +] [] . treestep\n", - " [] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " [] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " [] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec\n", - " [] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec\n", - " [] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec\n", - " [] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec\n", - " [] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec\n", - " [] 0 [] . TS1 [TS0] dip [map sum +] genrec\n", - " [] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec\n", - " [] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec\n", - " [] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec\n", - " [] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec\n", - " [] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec\n", - " [] 0 . TS0 [uncons [] dip i] [map sum +] genrec\n", - " [] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec\n", - " [] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec\n", - " [] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec\n", - " [] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec\n", - " [] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte\n", - "[] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[]] [not] . infra first choice i\n", - " [] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i\n", - " True . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i\n", - " True [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] . swaack first choice i\n", - " [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [True] . first choice i\n", - " [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] True . choice i\n", - " [] [pop 0] . i\n", - " [] . pop 0\n", - " . 0\n", - " 0 . \n" - ] - } - ], - "source": [ - "V('[] 0 [sum +] [] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": { - "collapsed": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " . [23 []] 0 [sum +] [] treestep\n", - " [23 []] . 0 [sum +] [] treestep\n", - " [23 []] 0 . [sum +] [] treestep\n", - " [23 []] 0 [sum +] . [] treestep\n", - " [23 []] 0 [sum +] [] . treestep\n", - " [23 []] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " [23 []] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " [23 []] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec\n", - " [23 []] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec\n", - " [23 []] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec\n", - " [23 []] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec\n", - " [23 []] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec\n", - " [23 []] 0 [] . TS1 [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec\n", - " [23 []] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec\n", - " [23 []] 0 . TS0 [uncons [] dip i] [map sum +] genrec\n", - " [23 []] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec\n", - " [23 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec\n", - " [23 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec\n", - " [23 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte\n", - "[23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 []]] [not] . infra first choice i\n", - " [23 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i\n", - " False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i\n", - " False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] . swaack first choice i\n", - " [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i\n", - " [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i\n", - " [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i\n", - " [23 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum +\n", - " 23 [] . sum +\n", - " 23 [] . 0 [+] catamorphism +\n", - " 23 [] 0 . [+] catamorphism +\n", - " 23 [] 0 [+] . catamorphism +\n", - " 23 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism +\n", - " 23 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism +\n", - " 23 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism +\n", - " 23 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism +\n", - " 23 [] [[] =] 0 [uncons swap] [+] . hylomorphism +\n", - " 23 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec +\n", - " 23 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec +\n", - " 23 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec +\n", - " 23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte +\n", - " 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i +\n", - " 23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i +\n", - " 23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i +\n", - " 23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i +\n", - " 23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i +\n", - " 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i +\n", - " 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i +\n", - " 23 [] [pop 0] . i +\n", - " 23 [] . pop 0 +\n", - " 23 . 0 +\n", - " 23 0 . +\n", - " 23 . \n" - ] - } - ], - "source": [ - "V('[23 []] 0 [sum +] [] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " . [23 [[2 []] [3 []]]] 0 [sum +] [] treestep\n", - " [23 [[2 []] [3 []]]] . 0 [sum +] [] treestep\n", - " [23 [[2 []] [3 []]]] 0 . [sum +] [] treestep\n", - " [23 [[2 []] [3 []]]] 0 [sum +] . [] treestep\n", - " [23 [[2 []] [3 []]]] 0 [sum +] [] . treestep\n", - " [23 [[2 []] [3 []]]] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec\n", - " [23 [[2 []] [3 []]]] 0 [] . TS1 [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 . TS0 [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec\n", - " [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec\n", - " [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte\n", - " [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 [[2 []] [3 []]]]] [not] . infra first choice i\n", - " [23 [[2 []] [3 []]]] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i\n", - " False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i\n", - " False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] . swaack first choice i\n", - " [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i\n", - " [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i\n", - " [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i\n", - " [23 [[2 []] [3 []]]] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[[2 []] [3 []]]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[[2 []] [3 []]]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 . [[[2 []] [3 []]]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[[2 []] [3 []]]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 . [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[2 []] [3 []]] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +\n", - " 23 [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum +\n", - "23 [] [[[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first] . infra sum +\n", - " . [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " [[3 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[3 []] 23] [not] . infra first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] . swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 [3 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] . sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] . 0 [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] 0 . [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] 0 [+] . catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 3 23] [[] =] . infra first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] . swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 3 23] . first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] [pop 0] . i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] . pop 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 . 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 0 . + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 . [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 23 3 [] . swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " [3 23] . first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 3 . [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 3 [[2 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum +\n", - " 3 [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [23] swaack sum +\n", - " 23 [2 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[2 []] 23] [not] . infra first choice i [3] swaack first [23] swaack sum +\n", - " 23 [2 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum +\n", - " 23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum +\n", - " 23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] . swaack first choice i [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [3] swaack first [23] swaack sum +\n", - " 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [3] swaack first [23] swaack sum +\n", - " 23 [2 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [] . sum + [3] swaack first [23] swaack sum +\n", - " 23 2 [] . 0 [+] catamorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] 0 . [+] catamorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] 0 [+] . catamorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 2 23] [[] =] . infra first choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] . swaack first choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 2 23] . first choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [3] swaack first [23] swaack sum +\n", - " 23 2 [] [pop 0] . i + [3] swaack first [23] swaack sum +\n", - " 23 2 [] . pop 0 + [3] swaack first [23] swaack sum +\n", - " 23 2 . 0 + [3] swaack first [23] swaack sum +\n", - " 23 2 0 . + [3] swaack first [23] swaack sum +\n", - " 23 2 . [3] swaack first [23] swaack sum +\n", - " 23 2 [3] . swaack first [23] swaack sum +\n", - " 3 [2 23] . first [23] swaack sum +\n", - " 3 2 . [23] swaack sum +\n", - " 3 2 [23] . swaack sum +\n", - " 23 [2 3] . sum +\n", - " 23 [2 3] . 0 [+] catamorphism +\n", - " 23 [2 3] 0 . [+] catamorphism +\n", - " 23 [2 3] 0 [+] . catamorphism +\n", - " 23 [2 3] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism +\n", - " 23 [2 3] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism +\n", - " 23 [2 3] [[] =] 0 [+] . [uncons swap] swap hylomorphism +\n", - " 23 [2 3] [[] =] 0 [+] [uncons swap] . swap hylomorphism +\n", - " 23 [2 3] [[] =] 0 [uncons swap] [+] . hylomorphism +\n", - " 23 [2 3] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap] [dip +] . genrec +\n", - " 23 [2 3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte +\n", - " 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[2 3] 23] [[] =] . infra first choice i +\n", - " 23 [2 3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i +\n", - " 23 [2 3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i +\n", - " 23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i +\n", - " 23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] . swaack first choice i +\n", - " 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i +\n", - " 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i +\n", - " 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i +\n", - " 23 [2 3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + +\n", - " 23 2 [3] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + +\n", - " 23 [3] 2 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + +\n", - " 23 [3] 2 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + +\n", - " 23 [3] . [[] =] [pop 0] [uncons swap] [dip +] genrec 2 + +\n", - " 23 [3] [[] =] . [pop 0] [uncons swap] [dip +] genrec 2 + +\n", - " 23 [3] [[] =] [pop 0] . [uncons swap] [dip +] genrec 2 + +\n", - " 23 [3] [[] =] [pop 0] [uncons swap] . [dip +] genrec 2 + +\n", - " 23 [3] [[] =] [pop 0] [uncons swap] [dip +] . genrec 2 + +\n", - " 23 [3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 2 + +\n", - " 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[3] 23] [[] =] . infra first choice i 2 + +\n", - " 23 [3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + +\n", - " 23 [3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + +\n", - " 23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + +\n", - " 23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] . swaack first choice i 2 + +\n", - " 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i 2 + +\n", - " 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 2 + +\n", - " 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 2 + +\n", - " 23 [3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + +\n", - " 23 3 [] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + +\n", - " 23 [] 3 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + +\n", - " 23 [] 3 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 2 + +\n", - " 23 [] . [[] =] [pop 0] [uncons swap] [dip +] genrec 3 + 2 + +\n", - " 23 [] [[] =] . [pop 0] [uncons swap] [dip +] genrec 3 + 2 + +\n", - " 23 [] [[] =] [pop 0] . [uncons swap] [dip +] genrec 3 + 2 + +\n", - " 23 [] [[] =] [pop 0] [uncons swap] . [dip +] genrec 3 + 2 + +\n", - " 23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec 3 + 2 + +\n", - " 23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 3 + 2 + +\n", - " 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i 3 + 2 + +\n", - " 23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + +\n", - " 23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + +\n", - " 23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + +\n", - " 23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i 3 + 2 + +\n", - " 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i 3 + 2 + +\n", - " 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i 3 + 2 + +\n", - " 23 [] [pop 0] . i 3 + 2 + +\n", - " 23 [] . pop 0 3 + 2 + +\n", - " 23 . 0 3 + 2 + +\n", - " 23 0 . 3 + 2 + +\n", - " 23 0 3 . + 2 + +\n", - " 23 3 . 2 + +\n", - " 23 3 2 . + +\n", - " 23 5 . +\n", - " 28 . \n" - ] - } - ], - "source": [ - "V('[23 [[2 []] [3 []]]] 0 [sum +] [] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "140\n" - ] - } - ], - "source": [ - "J('[23 [[2 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]] [3 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]]]] 0 [sum +] [] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[]\n" - ] - } - ], - "source": [ - "J('[] [] [unit cons] [23 +] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[46 []]\n" - ] - } - ], - "source": [ - "J('[23 []] [] [unit cons] [23 +] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[46 [[25 []] [26 []]]]\n" - ] - } - ], - "source": [ - "J('[23 [[2 []] [3 []]]] [] [unit cons] [23 +] treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [], - "source": [ - "define('treemap == [] [unit cons] roll< treestep')" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[46 [[25 []] [26 []]]]\n" - ] - } - ], - "source": [ - "J('[23 [[2 []] [3 []]]] [23 +] treemap')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.md b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.md index dfb43dc..f5e5a10 100644 --- a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.md +++ b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.md @@ -1906,544 +1906,3 @@ V('[2 1] [[] =] [pop c ] [uncons swap] [dip F] genrec') I think they are having slightly too much fun with the symbols. "Too much is always better than not enough." - -# Tree with node and list of trees. - - tree = [] | [node [tree*]] - -### `treestep` - - tree z [C] [N] treestep - - - [] z [C] [N] treestep - --------------------------- - z - - - [node [tree*]] z [C] [N] treestep - --------------------------------------- w/ K == z [C] [N] treestep - node N [tree*] [K] map C - -### Derive the recursive form. - K == [not] [pop z] [J] ifte - - - [node [tree*]] J - ------------------------------ - node N [tree*] [K] map C - - - J == .. [N] .. [K] .. [C] .. - - [node [tree*]] uncons [N] dip - node [[tree*]] [N] dip - node N [[tree*]] - - node N [[tree*]] i [K] map - node N [tree*] [K] map - node N [K.tree*] - - J == uncons [N] dip i [K] map [C] i - - K == [not] [pop z] [uncons [N] dip i [K] map [C] i] ifte - K == [not] [pop z] [uncons [N] dip i] [map [C] i] genrec - -### Extract the givens to parameterize the program. - [not] [pop z] [uncons [N] dip unquote] [map [C] i] genrec - [not] [z] [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec - [not] z unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec - z [not] swap unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec - \............TS0............/ - z TS0 [uncons [N] dip unquote] [map [C] i] genrec - z [uncons [N] dip unquote] [TS0] dip [map [C] i] genrec - z [[N] dip unquote] [uncons] swoncat [TS0] dip [map [C] i] genrec - z [N] [dip unquote] cons [uncons] swoncat [TS0] dip [map [C] i] genrec - \...........TS1.................../ - z [N] TS1 [TS0] dip [map [C] i] genrec - z [N] [map [C] i] [TS1 [TS0] dip] dip genrec - z [N] [map C ] [TS1 [TS0] dip] dip genrec - z [N] [C] [map] swoncat [TS1 [TS0] dip] dip genrec - z [C] [N] swap [map] swoncat [TS1 [TS0] dip] dip genrec - - TS0 == [not] swap unit [pop] swoncat - TS1 == [dip i] cons [uncons] swoncat - treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec - - [] 0 [C] [N] treestep - --------------------------- - 0 - - - [n [tree*]] 0 [sum +] [] treestep - -------------------------------------------------- - n [tree*] [0 [sum +] [] treestep] map sum + - - -```python -DefinitionWrapper.add_definitions(''' - - TS0 == [not] swap unit [pop] swoncat - TS1 == [dip i] cons [uncons] swoncat -treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec - -''', D) -``` - - -```python -V('[] 0 [sum +] [] treestep') -``` - - . [] 0 [sum +] [] treestep - [] . 0 [sum +] [] treestep - [] 0 . [sum +] [] treestep - [] 0 [sum +] . [] treestep - [] 0 [sum +] [] . treestep - [] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec - [] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec - [] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec - [] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec - [] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec - [] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec - [] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec - [] 0 [] . TS1 [TS0] dip [map sum +] genrec - [] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec - [] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec - [] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec - [] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec - [] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec - [] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec - [] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec - [] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec - [] 0 . TS0 [uncons [] dip i] [map sum +] genrec - [] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec - [] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec - [] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec - [] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec - [] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec - [] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec - [] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte - [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[]] [not] . infra first choice i - [] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i - True . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i - True [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] . swaack first choice i - [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [True] . first choice i - [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] True . choice i - [] [pop 0] . i - [] . pop 0 - . 0 - 0 . - - - -```python -V('[23 []] 0 [sum +] [] treestep') -``` - - . [23 []] 0 [sum +] [] treestep - [23 []] . 0 [sum +] [] treestep - [23 []] 0 . [sum +] [] treestep - [23 []] 0 [sum +] . [] treestep - [23 []] 0 [sum +] [] . treestep - [23 []] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec - [23 []] 0 [] . TS1 [TS0] dip [map sum +] genrec - [23 []] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec - [23 []] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec - [23 []] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec - [23 []] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec - [23 []] 0 . TS0 [uncons [] dip i] [map sum +] genrec - [23 []] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec - [23 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec - [23 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec - [23 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 []]] [not] . infra first choice i - [23 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i - False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i - False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] . swaack first choice i - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i - [23 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + - 23 [] . sum + - 23 [] . 0 [+] catamorphism + - 23 [] 0 . [+] catamorphism + - 23 [] 0 [+] . catamorphism + - 23 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + - 23 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + - 23 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + - 23 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + - 23 [] [[] =] 0 [uncons swap] [+] . hylomorphism + - 23 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + - 23 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + - 23 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + - 23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i + - 23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i + - 23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i + - 23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i + - 23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + - 23 [] [pop 0] . i + - 23 [] . pop 0 + - 23 . 0 + - 23 0 . + - 23 . - - - -```python -V('[23 [[2 []] [3 []]]] 0 [sum +] [] treestep') -``` - - . [23 [[2 []] [3 []]]] 0 [sum +] [] treestep - [23 [[2 []] [3 []]]] . 0 [sum +] [] treestep - [23 [[2 []] [3 []]]] 0 . [sum +] [] treestep - [23 [[2 []] [3 []]]] 0 [sum +] . [] treestep - [23 [[2 []] [3 []]]] 0 [sum +] [] . treestep - [23 [[2 []] [3 []]]] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec - [23 [[2 []] [3 []]]] 0 [] . TS1 [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 . TS0 [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec - [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 [[2 []] [3 []]]]] [not] . infra first choice i - [23 [[2 []] [3 []]]] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i - False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i - False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] . swaack first choice i - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i - [23 [[2 []] [3 []]]] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[[2 []] [3 []]]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[[2 []] [3 []]]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [[[2 []] [3 []]]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[[2 []] [3 []]]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[2 []] [3 []]] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + - 23 [] [[[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first] . infra sum + - . [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - [[3 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[3 []] 23] [not] . infra first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] . swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . 0 [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 . [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 [+] . catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 3 23] [[] =] . infra first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] . swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 3 23] . first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [pop 0] . i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . pop 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 0 . + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - [3 23] . first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 3 . [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 3 [[2 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 3 [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [23] swaack sum + - 23 [2 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[2 []] 23] [not] . infra first choice i [3] swaack first [23] swaack sum + - 23 [2 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum + - 23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum + - 23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] . swaack first choice i [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [3] swaack first [23] swaack sum + - 23 [2 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [3] swaack first [23] swaack sum + - 23 2 [] . sum + [3] swaack first [23] swaack sum + - 23 2 [] . 0 [+] catamorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 . [+] catamorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 [+] . catamorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [3] swaack first [23] swaack sum + - 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 2 23] [[] =] . infra first choice i + [3] swaack first [23] swaack sum + - 23 2 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] . swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 2 23] . first choice i + [3] swaack first [23] swaack sum + - 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [3] swaack first [23] swaack sum + - 23 2 [] [pop 0] . i + [3] swaack first [23] swaack sum + - 23 2 [] . pop 0 + [3] swaack first [23] swaack sum + - 23 2 . 0 + [3] swaack first [23] swaack sum + - 23 2 0 . + [3] swaack first [23] swaack sum + - 23 2 . [3] swaack first [23] swaack sum + - 23 2 [3] . swaack first [23] swaack sum + - 3 [2 23] . first [23] swaack sum + - 3 2 . [23] swaack sum + - 3 2 [23] . swaack sum + - 23 [2 3] . sum + - 23 [2 3] . 0 [+] catamorphism + - 23 [2 3] 0 . [+] catamorphism + - 23 [2 3] 0 [+] . catamorphism + - 23 [2 3] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + - 23 [2 3] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + - 23 [2 3] [[] =] 0 [+] . [uncons swap] swap hylomorphism + - 23 [2 3] [[] =] 0 [+] [uncons swap] . swap hylomorphism + - 23 [2 3] [[] =] 0 [uncons swap] [+] . hylomorphism + - 23 [2 3] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + - 23 [2 3] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + - 23 [2 3] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [dip +] . genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[2 3] 23] [[] =] . infra first choice i + - 23 [2 3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i + - 23 [2 3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i + - 23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i + - 23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] . swaack first choice i + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i + - 23 [2 3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + + - 23 2 [3] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + + - 23 [3] 2 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + + - 23 [3] 2 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + + - 23 [3] . [[] =] [pop 0] [uncons swap] [dip +] genrec 2 + + - 23 [3] [[] =] . [pop 0] [uncons swap] [dip +] genrec 2 + + - 23 [3] [[] =] [pop 0] . [uncons swap] [dip +] genrec 2 + + - 23 [3] [[] =] [pop 0] [uncons swap] . [dip +] genrec 2 + + - 23 [3] [[] =] [pop 0] [uncons swap] [dip +] . genrec 2 + + - 23 [3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[3] 23] [[] =] . infra first choice i 2 + + - 23 [3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + + - 23 [3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + + - 23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + + - 23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] . swaack first choice i 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 2 + + - 23 [3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + + - 23 3 [] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + + - 23 [] 3 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + + - 23 [] 3 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 2 + + - 23 [] . [[] =] [pop 0] [uncons swap] [dip +] genrec 3 + 2 + + - 23 [] [[] =] . [pop 0] [uncons swap] [dip +] genrec 3 + 2 + + - 23 [] [[] =] [pop 0] . [uncons swap] [dip +] genrec 3 + 2 + + - 23 [] [[] =] [pop 0] [uncons swap] . [dip +] genrec 3 + 2 + + - 23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec 3 + 2 + + - 23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 3 + 2 + + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i 3 + 2 + + - 23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + + - 23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + + - 23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + + - 23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i 3 + 2 + + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i 3 + 2 + + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i 3 + 2 + + - 23 [] [pop 0] . i 3 + 2 + + - 23 [] . pop 0 3 + 2 + + - 23 . 0 3 + 2 + + - 23 0 . 3 + 2 + + - 23 0 3 . + 2 + + - 23 3 . 2 + + - 23 3 2 . + + - 23 5 . + - 28 . - - - -```python -J('[23 [[2 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]] [3 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]]]] 0 [sum +] [] treestep') -``` - - 140 - - - -```python -J('[] [] [unit cons] [23 +] treestep') -``` - - [] - - - -```python -J('[23 []] [] [unit cons] [23 +] treestep') -``` - - [46 []] - - - -```python -J('[23 [[2 []] [3 []]]] [] [unit cons] [23 +] treestep') -``` - - [46 [[25 []] [26 []]]] - - - -```python -define('treemap == [] [unit cons] roll< treestep') -``` - - -```python -J('[23 [[2 []] [3 []]]] [23 +] treemap') -``` - - [46 [[25 []] [26 []]]] - diff --git a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.rst b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.rst index 14cbbb7..8c02236 100644 --- a/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.rst +++ b/docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.rst @@ -2105,576 +2105,3 @@ Wire" `__ I think they are having slightly too much fun with the symbols. "Too much is always better than not enough." - -Tree with node and list of trees. -================================= - -:: - - tree = [] | [node [tree*]] - -``treestep`` -~~~~~~~~~~~~ - -:: - - tree z [C] [N] treestep - - - [] z [C] [N] treestep - --------------------------- - z - - - [node [tree*]] z [C] [N] treestep - --------------------------------------- w/ K == z [C] [N] treestep - node N [tree*] [K] map C - -Derive the recursive form. -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -:: - - K == [not] [pop z] [J] ifte - - - [node [tree*]] J - ------------------------------ - node N [tree*] [K] map C - - - J == .. [N] .. [K] .. [C] .. - - [node [tree*]] uncons [N] dip - node [[tree*]] [N] dip - node N [[tree*]] - - node N [[tree*]] i [K] map - node N [tree*] [K] map - node N [K.tree*] - - J == uncons [N] dip i [K] map [C] i - - K == [not] [pop z] [uncons [N] dip i [K] map [C] i] ifte - K == [not] [pop z] [uncons [N] dip i] [map [C] i] genrec - -Extract the givens to parameterize the program. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -:: - - [not] [pop z] [uncons [N] dip unquote] [map [C] i] genrec - [not] [z] [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec - [not] z unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec - z [not] swap unit [pop] swoncat [uncons [N] dip unquote] [map [C] i] genrec - \............TS0............/ - z TS0 [uncons [N] dip unquote] [map [C] i] genrec - z [uncons [N] dip unquote] [TS0] dip [map [C] i] genrec - z [[N] dip unquote] [uncons] swoncat [TS0] dip [map [C] i] genrec - z [N] [dip unquote] cons [uncons] swoncat [TS0] dip [map [C] i] genrec - \...........TS1.................../ - z [N] TS1 [TS0] dip [map [C] i] genrec - z [N] [map [C] i] [TS1 [TS0] dip] dip genrec - z [N] [map C ] [TS1 [TS0] dip] dip genrec - z [N] [C] [map] swoncat [TS1 [TS0] dip] dip genrec - z [C] [N] swap [map] swoncat [TS1 [TS0] dip] dip genrec - -:: - - TS0 == [not] swap unit [pop] swoncat - TS1 == [dip i] cons [uncons] swoncat - treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec - -:: - - [] 0 [C] [N] treestep - --------------------------- - 0 - - - [n [tree*]] 0 [sum +] [] treestep - -------------------------------------------------- - n [tree*] [0 [sum +] [] treestep] map sum + - -.. code:: ipython2 - - DefinitionWrapper.add_definitions(''' - - TS0 == [not] swap unit [pop] swoncat - TS1 == [dip i] cons [uncons] swoncat - treestep == swap [map] swoncat [TS1 [TS0] dip] dip genrec - - ''', D) - -.. code:: ipython2 - - V('[] 0 [sum +] [] treestep') - - -.. parsed-literal:: - - . [] 0 [sum +] [] treestep - [] . 0 [sum +] [] treestep - [] 0 . [sum +] [] treestep - [] 0 [sum +] . [] treestep - [] 0 [sum +] [] . treestep - [] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec - [] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec - [] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec - [] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec - [] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec - [] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec - [] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec - [] 0 [] . TS1 [TS0] dip [map sum +] genrec - [] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec - [] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec - [] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec - [] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec - [] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec - [] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec - [] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec - [] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec - [] 0 . TS0 [uncons [] dip i] [map sum +] genrec - [] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec - [] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec - [] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec - [] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec - [] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec - [] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec - [] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec - [] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte - [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[]] [not] . infra first choice i - [] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i - True . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] swaack first choice i - True [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] []] . swaack first choice i - [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [True] . first choice i - [] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] True . choice i - [] [pop 0] . i - [] . pop 0 - . 0 - 0 . - - -.. code:: ipython2 - - V('[23 []] 0 [sum +] [] treestep') - - -.. parsed-literal:: - - . [23 []] 0 [sum +] [] treestep - [23 []] . 0 [sum +] [] treestep - [23 []] 0 . [sum +] [] treestep - [23 []] 0 [sum +] . [] treestep - [23 []] 0 [sum +] [] . treestep - [23 []] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec - [23 []] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec - [23 []] 0 [] . TS1 [TS0] dip [map sum +] genrec - [23 []] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec - [23 []] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec - [23 []] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec - [23 []] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec - [23 []] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec - [23 []] 0 . TS0 [uncons [] dip i] [map sum +] genrec - [23 []] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec - [23 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec - [23 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec - [23 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec - [23 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 []]] [not] . infra first choice i - [23 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i - False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] swaack first choice i - False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 []]] . swaack first choice i - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i - [23 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i - [23 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + - 23 [] . sum + - 23 [] . 0 [+] catamorphism + - 23 [] 0 . [+] catamorphism + - 23 [] 0 [+] . catamorphism + - 23 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + - 23 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + - 23 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + - 23 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + - 23 [] [[] =] 0 [uncons swap] [+] . hylomorphism + - 23 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + - 23 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + - 23 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + - 23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + - 23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i + - 23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i + - 23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i + - 23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i + - 23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + - 23 [] [pop 0] . i + - 23 [] . pop 0 + - 23 . 0 + - 23 0 . + - 23 . - - -.. code:: ipython2 - - V('[23 [[2 []] [3 []]]] 0 [sum +] [] treestep') - - -.. parsed-literal:: - - . [23 [[2 []] [3 []]]] 0 [sum +] [] treestep - [23 [[2 []] [3 []]]] . 0 [sum +] [] treestep - [23 [[2 []] [3 []]]] 0 . [sum +] [] treestep - [23 [[2 []] [3 []]]] 0 [sum +] . [] treestep - [23 [[2 []] [3 []]]] 0 [sum +] [] . treestep - [23 [[2 []] [3 []]]] 0 [sum +] [] . swap [map] swoncat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [sum +] . [map] swoncat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swoncat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [sum +] [map] . swap concat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [map] [sum +] . concat [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [map sum +] . [TS1 [TS0] dip] dip genrec - [23 [[2 []] [3 []]]] 0 [] [map sum +] [TS1 [TS0] dip] . dip genrec - [23 [[2 []] [3 []]]] 0 [] . TS1 [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [] . [dip i] cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [] [dip i] . cons [uncons] swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [[] dip i] . [uncons] swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swoncat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [[] dip i] [uncons] . swap concat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [uncons] [[] dip i] . concat [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [uncons [] dip i] . [TS0] dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [uncons [] dip i] [TS0] . dip [map sum +] genrec - [23 [[2 []] [3 []]]] 0 . TS0 [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] 0 . [not] swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] 0 [not] . swap unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] 0 . unit [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] 0 . [] cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] 0 [] . cons [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [0] . [pop] swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [0] [pop] . swoncat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [0] [pop] . swap concat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop] [0] . concat [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec - [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec - [23 [[2 []] [3 []]]] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[23 [[2 []] [3 []]]]] [not] . infra first choice i - [23 [[2 []] [3 []]]] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i - False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] swaack first choice i - False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [23 [[2 []] [3 []]]]] . swaack first choice i - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False] . first choice i - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i - [23 [[2 []] [3 []]]] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i - [23 [[2 []] [3 []]]] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[[2 []] [3 []]]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[[2 []] [3 []]]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [[[2 []] [3 []]]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[[2 []] [3 []]]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 . [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[2 []] [3 []]] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + - 23 [[2 []] [3 []]] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + - 23 [] [[[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first] . infra sum + - . [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - [[3 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - [[3 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[3 []] 23] [not] . infra first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [3 []] 23] . swaack first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 [3 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . sum + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . 0 [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 . [+] catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 [+] . catamorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 3 23] [[] =] . infra first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 3 23] . swaack first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 3 23] . first choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] [pop 0] . i + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . pop 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . 0 + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 0 . + [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 . [] swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 23 3 [] . swaack first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - [3 23] . first [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 3 . [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 3 [[2 []] 23] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] infra first [23] swaack sum + - 3 [[2 []] 23] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . infra first [23] swaack sum + - 23 [2 []] . [not] [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] . [pop 0] [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] . [uncons [] dip i] [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] [uncons [] dip i] . [map sum +] genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] [uncons [] dip i] [map sum +] . genrec [3] swaack first [23] swaack sum + - 23 [2 []] [not] [pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . ifte [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [[2 []] 23] [not] . infra first choice i [3] swaack first [23] swaack sum + - 23 [2 []] . not [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum + - 23 False . [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] swaack first choice i [3] swaack first [23] swaack sum + - 23 False [[pop 0] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [2 []] 23] . swaack first choice i [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] [False 23] . first choice i [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] [pop 0] False . choice i [3] swaack first [23] swaack sum + - 23 [2 []] [uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum +] . i [3] swaack first [23] swaack sum + - 23 [2 []] . uncons [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [[]] . [] dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [[]] [] . dip i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 . [[]] i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [[]] . i [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 . [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [] . [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] map sum + [3] swaack first [23] swaack sum + - 23 2 [] [[not] [pop 0] [uncons [] dip i] [map sum +] genrec] . map sum + [3] swaack first [23] swaack sum + - 23 2 [] . sum + [3] swaack first [23] swaack sum + - 23 2 [] . 0 [+] catamorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 . [+] catamorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 [+] . catamorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [+] . [uncons swap] swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [+] [uncons swap] . swap hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [uncons swap] [+] . hylomorphism + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec + [3] swaack first [23] swaack sum + - 23 2 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + [3] swaack first [23] swaack sum + - 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 2 23] [[] =] . infra first choice i + [3] swaack first [23] swaack sum + - 23 2 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 2 23] . swaack first choice i + [3] swaack first [23] swaack sum + - 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 2 23] . first choice i + [3] swaack first [23] swaack sum + - 23 2 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i + [3] swaack first [23] swaack sum + - 23 2 [] [pop 0] . i + [3] swaack first [23] swaack sum + - 23 2 [] . pop 0 + [3] swaack first [23] swaack sum + - 23 2 . 0 + [3] swaack first [23] swaack sum + - 23 2 0 . + [3] swaack first [23] swaack sum + - 23 2 . [3] swaack first [23] swaack sum + - 23 2 [3] . swaack first [23] swaack sum + - 3 [2 23] . first [23] swaack sum + - 3 2 . [23] swaack sum + - 3 2 [23] . swaack sum + - 23 [2 3] . sum + - 23 [2 3] . 0 [+] catamorphism + - 23 [2 3] 0 . [+] catamorphism + - 23 [2 3] 0 [+] . catamorphism + - 23 [2 3] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism + - 23 [2 3] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism + - 23 [2 3] [[] =] 0 [+] . [uncons swap] swap hylomorphism + - 23 [2 3] [[] =] 0 [+] [uncons swap] . swap hylomorphism + - 23 [2 3] [[] =] 0 [uncons swap] [+] . hylomorphism + - 23 [2 3] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec + - 23 [2 3] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec + - 23 [2 3] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap] [dip +] . genrec + - 23 [2 3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[2 3] 23] [[] =] . infra first choice i + - 23 [2 3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i + - 23 [2 3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i + - 23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] swaack first choice i + - 23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 3] 23] . swaack first choice i + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i + - 23 [2 3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i + - 23 [2 3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + + - 23 2 [3] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + + - 23 [3] 2 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + + - 23 [3] 2 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + + - 23 [3] . [[] =] [pop 0] [uncons swap] [dip +] genrec 2 + + - 23 [3] [[] =] . [pop 0] [uncons swap] [dip +] genrec 2 + + - 23 [3] [[] =] [pop 0] . [uncons swap] [dip +] genrec 2 + + - 23 [3] [[] =] [pop 0] [uncons swap] . [dip +] genrec 2 + + - 23 [3] [[] =] [pop 0] [uncons swap] [dip +] . genrec 2 + + - 23 [3] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[3] 23] [[] =] . infra first choice i 2 + + - 23 [3] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + + - 23 [3] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + + - 23 False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] swaack first choice i 2 + + - 23 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3] 23] . swaack first choice i 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False 23] . first choice i 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 2 + + - 23 [3] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 2 + + - 23 [3] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + + - 23 3 [] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + + - 23 [] 3 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + + - 23 [] 3 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 2 + + - 23 [] . [[] =] [pop 0] [uncons swap] [dip +] genrec 3 + 2 + + - 23 [] [[] =] . [pop 0] [uncons swap] [dip +] genrec 3 + 2 + + - 23 [] [[] =] [pop 0] . [uncons swap] [dip +] genrec 3 + 2 + + - 23 [] [[] =] [pop 0] [uncons swap] . [dip +] genrec 3 + 2 + + - 23 [] [[] =] [pop 0] [uncons swap] [dip +] . genrec 3 + 2 + + - 23 [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 3 + 2 + + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[] 23] [[] =] . infra first choice i 3 + 2 + + - 23 [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + + - 23 [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + + - 23 True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] swaack first choice i 3 + 2 + + - 23 True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [] 23] . swaack first choice i 3 + 2 + + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True 23] . first choice i 3 + 2 + + - 23 [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i 3 + 2 + + - 23 [] [pop 0] . i 3 + 2 + + - 23 [] . pop 0 3 + 2 + + - 23 . 0 3 + 2 + + - 23 0 . 3 + 2 + + - 23 0 3 . + 2 + + - 23 3 . 2 + + - 23 3 2 . + + - 23 5 . + - 28 . - - -.. code:: ipython2 - - J('[23 [[2 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]] [3 [[23 [[2 []] [3 []]]][23 [[2 []] [3 []]]]]]]] 0 [sum +] [] treestep') - - -.. parsed-literal:: - - 140 - - -.. code:: ipython2 - - J('[] [] [unit cons] [23 +] treestep') - - -.. parsed-literal:: - - [] - - -.. code:: ipython2 - - J('[23 []] [] [unit cons] [23 +] treestep') - - -.. parsed-literal:: - - [46 []] - - -.. code:: ipython2 - - J('[23 [[2 []] [3 []]]] [] [unit cons] [23 +] treestep') - - -.. parsed-literal:: - - [46 [[25 []] [26 []]]] - - -.. code:: ipython2 - - define('treemap == [] [unit cons] roll< treestep') - -.. code:: ipython2 - - J('[23 [[2 []] [3 []]]] [23 +] treemap') - - -.. parsed-literal:: - - [46 [[25 []] [26 []]]] - diff --git a/docs/Makefile b/docs/Makefile index 4f8ca20..2ec9f12 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -22,7 +22,9 @@ $(docs_md): %.md : %.ipynb $(docs_rst): %.rst : %.ipynb python -m nbconvert --to rst $< -move_us = Generator_Programs.rst Ordered_Binary_Trees.rst Quadratic.rst Replacing.rst Treestep.rst Zipper.rst + +move_us = Generator_Programs.rst Newton-Raphson.rst Ordered_Binary_Trees.rst Quadratic.rst Replacing.rst Treestep.rst Zipper.rst mov: $(move_us) cp -v $? ./sphinx_docs/notebooks/ + diff --git a/docs/Newton-Raphson.html b/docs/Newton-Raphson.html index 1288221..793aa6b 100644 --- a/docs/Newton-Raphson.html +++ b/docs/Newton-Raphson.html @@ -11867,21 +11867,6 @@ n+1 2 /
In [2]:
-
-
-
define('codireco == cons dip rest cons')
-define('make_generator == [codireco] ccons')
-define('ccons == cons cons')
-
- -
-
-
- -
-
-
-
In [3]:
define('gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator')
@@ -11894,7 +11879,7 @@ n+1       2 /
 
-
In [4]:
+
In [3]:
J('23 gsra')
@@ -11934,7 +11919,7 @@ n+1       2 /
 
-
In [5]:
+
In [4]:
J('23 gsra 6 [x popd] times first sqr')
@@ -11967,9 +11952,9 @@ n+1       2 /
 
-

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.

+

Finding Consecutive Approximations within a Tolerance

From "Why Functional Programming Matters" by John Hughes:

+

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...

@@ -12002,7 +11987,7 @@ abs(a-b) ε <=
-
In [6]:
+
In [5]:
define('_within_P == [first - abs] dip <=')
@@ -12028,7 +12013,7 @@ abs(a-b)            ε                   <=
 
-
In [7]:
+
In [6]:
define('_within_B == roll< popop first')
@@ -12049,8 +12034,8 @@ abs(a-b)            ε                   <=
 
  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. +
  7. Use x combinator to generate next term from G.
  8. +
  9. Run within with i (it is a primrec function.)

Pretty straightforward:

@@ -12068,7 +12053,7 @@ b [c G] ε within
-
In [8]:
+
In [7]:
define('_within_R == [popd x] dip')
@@ -12093,7 +12078,7 @@ a [b G] ε ...
-
In [9]:
+
In [8]:
define('within == x 0.000000001 [_within_P] [_within_B] [_within_R] primrec')
@@ -12104,6 +12089,46 @@ a [b G] ε ...
+
+
+
+
+
+

Try it out...

+ +
+
+
+
+
+
In [9]:
+
+
+
J('36 sqrt')
+
+ +
+
+
+ +
+
+ + +
+ +
+ + +
+
6.0
+
+
+
+ +
+
+
@@ -12135,6 +12160,15 @@ a [b G] ε ...
+
+
+
+
+
+

Check it.

+ +
+
@@ -12168,6 +12202,41 @@ a [b G] ε ...
+
+
+
+
In [12]:
+
+
+
from math import sqrt
+
+sqrt(23)
+
+ +
+
+
+ +
+
+ + +
+ +
Out[12]:
+ + + + +
+
4.795831523312719
+
+ +
+ +
+
+
diff --git a/docs/Newton-Raphson.ipynb b/docs/Newton-Raphson.ipynb index 99897a3..742a966 100644 --- a/docs/Newton-Raphson.ipynb +++ b/docs/Newton-Raphson.ipynb @@ -87,17 +87,6 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "define('codireco == cons dip rest cons')\n", - "define('make_generator == [codireco] ccons')\n", - "define('ccons == cons cons')" - ] - }, - { - "cell_type": "code", - "execution_count": 3, "metadata": { "scrolled": true }, @@ -108,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -132,7 +121,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -153,11 +142,11 @@ "source": [ "## Finding Consecutive Approximations within a Tolerance\n", "\n", + "From [\"Why Functional Programming Matters\" by John Hughes](https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf):\n", + "\n", "\n", "> 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.\n", "\n", - "From [\"Why Functional Programming Matters\" by John Hughes](https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf)\n", - "\n", "(And note that by “list” he means a lazily-evaluated list.)\n", "\n", "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...\n", @@ -189,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -210,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -226,8 +215,8 @@ " a [b G] ε R0 [within] R1\n", "\n", "1. Discard a.\n", - "2. Use x combinator to generate next term from G.\n", - "3. Run within with `i` (it is a `primrec` function.)\n", + "2. Use `x` combinator to generate next term from `G`.\n", + "3. Run `within` with `i` (it is a `primrec` function.)\n", "\n", "Pretty straightforward:\n", "\n", @@ -243,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -264,7 +253,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -272,6 +261,32 @@ "define('sqrt == gsra within')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Try it out..." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6.0\n" + ] + } + ], + "source": [ + "J('36 sqrt')" + ] + }, { "cell_type": "code", "execution_count": 10, @@ -291,6 +306,13 @@ "J('23 sqrt')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check it." + ] + }, { "cell_type": "code", "execution_count": 11, @@ -312,6 +334,28 @@ "source": [ "4.795831523312719**2" ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4.795831523312719" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from math import sqrt\n", + "\n", + "sqrt(23)" + ] } ], "metadata": { diff --git a/docs/Newton-Raphson.md b/docs/Newton-Raphson.md index 3f0735f..eccb6a9 100644 --- a/docs/Newton-Raphson.md +++ b/docs/Newton-Raphson.md @@ -55,13 +55,6 @@ The generator can be written as: 1 [dup 23 over / + 2 /] make_generator -```python -define('codireco == cons dip rest cons') -define('make_generator == [codireco] ccons') -define('ccons == cons cons') -``` - - ```python define('gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator') ``` @@ -86,11 +79,11 @@ J('23 gsra 6 [x popd] times first sqr') ## Finding Consecutive Approximations within a Tolerance +From ["Why Functional Programming Matters" by John Hughes](https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf): + > 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](https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf) - (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... @@ -137,8 +130,8 @@ define('_within_B == roll< popop first') 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.) +2. Use `x` combinator to generate next term from `G`. +3. Run `within` with `i` (it is a `primrec` function.) Pretty straightforward: @@ -169,6 +162,16 @@ define('within == x 0.000000001 [_within_P] [_within_B] [_within_R] primrec') define('sqrt == gsra within') ``` +Try it out... + + +```python +J('36 sqrt') +``` + + 6.0 + + ```python J('23 sqrt') @@ -177,6 +180,8 @@ J('23 sqrt') 4.795831523312719 +Check it. + ```python 4.795831523312719**2 @@ -188,3 +193,17 @@ J('23 sqrt') 22.999999999999996 + + +```python +from math import sqrt + +sqrt(23) +``` + + + + + 4.795831523312719 + + diff --git a/docs/Newton-Raphson.rst b/docs/Newton-Raphson.rst index 829ad63..94e06e1 100644 --- a/docs/Newton-Raphson.rst +++ b/docs/Newton-Raphson.rst @@ -76,12 +76,6 @@ The generator can be written as: 1 [23 over / + 2 /] [dup] swoncat make_generator 1 [dup 23 over / + 2 /] make_generator -.. code:: ipython2 - - define('codireco == cons dip rest cons') - define('make_generator == [codireco] ccons') - define('ccons == cons cons') - .. code:: ipython2 define('gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator') @@ -112,14 +106,14 @@ square the approximation to see how well it works... Finding Consecutive Approximations within a Tolerance ----------------------------------------------------- +From `"Why Functional Programming Matters" by John +Hughes `__: + 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 @@ -175,8 +169,8 @@ 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.) +2. Use ``x`` combinator to generate next term from ``G``. +3. Run ``within`` with ``i`` (it is a ``primrec`` function.) Pretty straightforward: @@ -211,6 +205,18 @@ The recursive function we have defined so far needs a slight preamble: define('within == x 0.000000001 [_within_P] [_within_B] [_within_R] primrec') define('sqrt == gsra within') +Try it out... + +.. code:: ipython2 + + J('36 sqrt') + + +.. parsed-literal:: + + 6.0 + + .. code:: ipython2 J('23 sqrt') @@ -221,6 +227,8 @@ The recursive function we have defined so far needs a slight preamble: 4.795831523312719 +Check it. + .. code:: ipython2 4.795831523312719**2 @@ -233,3 +241,18 @@ The recursive function we have defined so far needs a slight preamble: 22.999999999999996 + +.. code:: ipython2 + + from math import sqrt + + sqrt(23) + + + + +.. parsed-literal:: + + 4.795831523312719 + + diff --git a/docs/sphinx_docs/_build/html/_modules/joy/library.html b/docs/sphinx_docs/_build/html/_modules/joy/library.html index aa2024e..55a87a3 100644 --- a/docs/sphinx_docs/_build/html/_modules/joy/library.html +++ b/docs/sphinx_docs/_build/html/_modules/joy/library.html @@ -157,6 +157,9 @@ dudipd == dup dipd primrec == [i] genrec step_zero == 0 roll> step +codireco == cons dip rest cons +make_generator == [codireco] ccons +ccons == cons cons ''' ##Zipper diff --git a/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html b/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html index 55d71e6..85e2050 100644 --- a/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html +++ b/docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html @@ -17,7 +17,7 @@ - + @@ -34,16 +34,18 @@

Newton’s method

-

Newton-Raphson for finding the root of an equation.

+

Let’s use the Newton-Raphson method for finding the root of an equation +to write a function that can compute the square root of a number.

+

Cf. “Why Functional Programming Matters” by John +Hughes

from notebook_preamble import J, V, define
 
-

Cf. “Why Functional Programming Matters” by John -Hughes

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:

+

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'
@@ -51,7 +53,8 @@ Hughes

A Function to Compute the Next Approximation

-

Looking at the equation again:

+

This is the equation for computing the next approximate value of the +square root:

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

a n over / + 2 /
 a n a    / + 2 /
@@ -71,7 +74,8 @@ Hughes

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:

+

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 /
@@ -80,48 +84,51 @@ Hughes

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]
 
+
define('gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator')
+
-
-

A Generator of Square Root Approximations

-
gsra == 1 swap [over / + 2 /] cons [dup] swoncat make_generator
+
J('23 gsra')
+
+
+
[1 [dup 23 over / + 2 /] codireco]
+
+
+

Let’s drive the generator a few time (with the x combinator) and +square the approximation to see how well it works…

+
J('23 gsra 6 [x popd] times first sqr')
+
+
+
23.0000000001585
 
-

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.
+

Finding Consecutive Approximations within a Tolerance

From “Why Functional Programming Matters” by John -Hughes

+Hughes:

+
+
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 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…

+

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 G] ε within
 ---------------------- a b - abs ε >
-       .
-   [b G] x ε ...
-   b [c G] ε ...
-       .
-----------------------
    b [c G] ε within
 
@@ -135,7 +142,7 @@ Hughes

(abs(a-b)<=ε)
-
P == [first - abs] dip <=
+
define('_within_P == [first - abs] dip <=')
 
@@ -147,7 +154,7 @@ Hughes

b
-
B == roll< popop first
+
define('_within_B == roll< popop first')
 
@@ -157,10 +164,11 @@ Hughes

    -
  1. Discard a.
  2. +
  3. Discard a.
  4. Use x combinator to generate next term from G.
  5. Run within with i (it is a primrec function.)
+

Pretty straightforward:

a [b G]        ε R0           [within] R1
 a [b G]        ε [popd x] dip [within] i
 a [b G] popd x ε              [within] i
@@ -171,34 +179,51 @@ Hughes

b [c G] ε within
-
R0 == [popd x] dip
+
define('_within_R == [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:

+

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
+
define('within == x 0.000000001 [_within_P] [_within_B] [_within_R] primrec')
+define('sqrt == gsra within')
 
-
-
-
-

Finding Square Roots

-
sqrt == gsra within
+

Try it out…

+
J('36 sqrt')
 
+
6.0
+
+
+
J('23 sqrt')
+
+
+
4.795831523312719
+
+
+

Check it.

+
4.795831523312719**2
+
+
+
22.999999999999996
+
+
+
from math import sqrt
+
+sqrt(23)
+
+
+
4.795831523312719
+
+
+
@@ -214,18 +239,15 @@ Hughes

  • A Generator for Approximations
  • -
  • Finding Consecutive Approximations within a Tolerance
  • @@ -234,7 +256,7 @@ Hughes

    diff --git a/docs/sphinx_docs/_build/html/notebooks/Zipper.html b/docs/sphinx_docs/_build/html/notebooks/Zipper.html index d64edb6..d424e17 100644 --- a/docs/sphinx_docs/_build/html/notebooks/Zipper.html +++ b/docs/sphinx_docs/_build/html/notebooks/Zipper.html @@ -16,6 +16,8 @@ + + @@ -323,6 +325,10 @@ i d i d i d d Bingo!

    Related Topics

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