OSDN Git Service

Working on bug #15
[joypy/Thun.git] / docs / Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.ipynb
1 {
2  "cells": [
3   {
4    "cell_type": "markdown",
5    "metadata": {},
6    "source": [
7     "Cf. [\"Bananas, Lenses, & Barbed Wire\"](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.125)"
8    ]
9   },
10   {
11    "cell_type": "markdown",
12    "metadata": {},
13    "source": [
14     "# [Hylomorphism](https://en.wikipedia.org/wiki/Hylomorphism_%28computer_science%29)\n",
15     "A [hylomorphism](https://en.wikipedia.org/wiki/Hylomorphism_%28computer_science%29) `H :: A -> B` converts a value of type A into a value of type B by means of:\n",
16     "\n",
17     "- A generator `G :: A -> (A, B)`\n",
18     "- A combiner `F :: (B, B) -> B`\n",
19     "- A predicate `P :: A -> Bool` to detect the base case\n",
20     "- A base case value `c :: B`\n",
21     "- Recursive calls (zero or more); it has a \"call stack in the form of a cons list\".\n",
22     "\n",
23     "It may be helpful to see this function implemented in imperative Python code."
24    ]
25   },
26   {
27    "cell_type": "code",
28    "execution_count": 1,
29    "metadata": {},
30    "outputs": [],
31    "source": [
32     "def hylomorphism(c, F, P, G):\n",
33     "    '''Return a hylomorphism function H.'''\n",
34     "\n",
35     "    def H(a):\n",
36     "        if P(a):\n",
37     "            result = c\n",
38     "        else:\n",
39     "            b, aa = G(a)\n",
40     "            result = F(b, H(aa))\n",
41     "        return result\n",
42     "\n",
43     "    return H"
44    ]
45   },
46   {
47    "cell_type": "markdown",
48    "metadata": {},
49    "source": [
50     "### Finding [Triangular Numbers](https://en.wikipedia.org/wiki/Triangular_number)\n",
51     "As a concrete example let's use a function that, given a positive integer, returns the sum of all positive integers less than that one.  (In this case the types A and B are both `int`.)\n",
52     "### With `range()` and `sum()`"
53    ]
54   },
55   {
56    "cell_type": "code",
57    "execution_count": 2,
58    "metadata": {},
59    "outputs": [
60     {
61      "data": {
62       "text/plain": [
63        "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
64       ]
65      },
66      "execution_count": 2,
67      "metadata": {},
68      "output_type": "execute_result"
69     }
70    ],
71    "source": [
72     "r = range(10)\n",
73     "r"
74    ]
75   },
76   {
77    "cell_type": "code",
78    "execution_count": 3,
79    "metadata": {},
80    "outputs": [
81     {
82      "data": {
83       "text/plain": [
84        "45"
85       ]
86      },
87      "execution_count": 3,
88      "metadata": {},
89      "output_type": "execute_result"
90     }
91    ],
92    "source": [
93     "sum(r)"
94    ]
95   },
96   {
97    "cell_type": "code",
98    "execution_count": 4,
99    "metadata": {},
100    "outputs": [
101     {
102      "data": {
103       "text/plain": [
104        "45"
105       ]
106      },
107      "execution_count": 4,
108      "metadata": {},
109      "output_type": "execute_result"
110     }
111    ],
112    "source": [
113     "range_sum = lambda n: sum(range(n))\n",
114     "range_sum(10)"
115    ]
116   },
117   {
118    "cell_type": "markdown",
119    "metadata": {},
120    "source": [
121     "### As a hylomorphism"
122    ]
123   },
124   {
125    "cell_type": "code",
126    "execution_count": 5,
127    "metadata": {},
128    "outputs": [],
129    "source": [
130     "G = lambda n: (n - 1, n - 1)\n",
131     "F = lambda a, b: a + b\n",
132     "P = lambda n: n <= 1\n",
133     "\n",
134     "H = hylomorphism(0, F, P, G)"
135    ]
136   },
137   {
138    "cell_type": "code",
139    "execution_count": 6,
140    "metadata": {},
141    "outputs": [
142     {
143      "data": {
144       "text/plain": [
145        "45"
146       ]
147      },
148      "execution_count": 6,
149      "metadata": {},
150      "output_type": "execute_result"
151     }
152    ],
153    "source": [
154     "H(10)"
155    ]
156   },
157   {
158    "cell_type": "markdown",
159    "metadata": {},
160    "source": [
161     "If you were to run the above code in a debugger and check out the call stack you would find that the variable `b` in each call to `H()` is storing the intermediate values as `H()` recurses.  This is what was meant by \"call stack in the form of a cons list\"."
162    ]
163   },
164   {
165    "cell_type": "markdown",
166    "metadata": {},
167    "source": [
168     "### Joy Preamble"
169    ]
170   },
171   {
172    "cell_type": "code",
173    "execution_count": 7,
174    "metadata": {},
175    "outputs": [],
176    "source": [
177     "from notebook_preamble import D, DefinitionWrapper, J, V, define"
178    ]
179   },
180   {
181    "cell_type": "markdown",
182    "metadata": {},
183    "source": [
184     "## Hylomorphism in Joy\n",
185     "We can define a combinator `hylomorphism` that will make a hylomorphism combinator `H` from constituent parts.\n",
186     "\n",
187     "    H == c [F] [P] [G] hylomorphism\n",
188     "\n",
189     "The function `H` is recursive, so we start with `ifte` and set the else-part to\n",
190     "some function `J` that will contain a quoted copy of `H`.  (The then-part just\n",
191     "discards the leftover `a` and replaces it with the base case value `c`.)\n",
192     "\n",
193     "    H == [P] [pop c] [J] ifte\n",
194     "\n",
195     "The else-part `J` gets just the argument `a` on the stack.\n",
196     "\n",
197     "    a J\n",
198     "    a G              The first thing to do is use the generator G\n",
199     "    aa b             which produces b and a new aa\n",
200     "    aa b [H] dip     we recur with H on the new aa\n",
201     "    aa H b F         and run F on the result.\n",
202     "\n",
203     "This gives us a definition for `J`.\n",
204     "\n",
205     "    J == G [H] dip F\n",
206     "\n",
207     "Plug it in and convert to genrec.\n",
208     "\n",
209     "    H == [P] [pop c] [G [H] dip F] ifte\n",
210     "    H == [P] [pop c] [G]   [dip F] genrec\n",
211     "\n",
212     "This is the form of a hylomorphism in Joy, which nicely illustrates that\n",
213     "it is a simple specialization of the general recursion combinator.\n",
214     "\n",
215     "    H == [P] [pop c] [G] [dip F] genrec"
216    ]
217   },
218   {
219    "cell_type": "markdown",
220    "metadata": {},
221    "source": [
222     "## Derivation of `hylomorphism`\n",
223     "\n",
224     "Now we just need to derive a definition that builds the `genrec` arguments\n",
225     "out of the pieces given to the `hylomorphism` combinator.\n",
226     "\n",
227     "    H == [P] [pop c]              [G]                  [dip F] genrec\n",
228     "         [P] [c]    [pop] swoncat [G]        [F] [dip] swoncat genrec\n",
229     "         [P] c unit [pop] swoncat [G]        [F] [dip] swoncat genrec\n",
230     "         [P] c [G] [F] [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
231     "\n",
232     "Working in reverse:\n",
233     "- Use `swoncat` twice to decouple `[c]` and `[F]`.\n",
234     "- Use `unit` to dequote `c`.\n",
235     "- Use `dipd` to untangle `[unit [pop] swoncat]` from the givens.\n",
236     "\n",
237     "At this point all of the arguments (givens) to the hylomorphism are to the left so we have\n",
238     "a definition for `hylomorphism`:\n",
239     "\n",
240     "    hylomorphism == [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
241     "\n",
242     "The order of parameters is different than the one we started with but\n",
243     "that hardly matters, you can rearrange them or just supply them in the\n",
244     "expected order.\n",
245     "\n",
246     "    [P] c [G] [F] hylomorphism == H\n",
247     "\n"
248    ]
249   },
250   {
251    "cell_type": "code",
252    "execution_count": 8,
253    "metadata": {},
254    "outputs": [],
255    "source": [
256     "define('hylomorphism == [unit [pop] swoncat] dipd [dip] swoncat genrec')"
257    ]
258   },
259   {
260    "cell_type": "markdown",
261    "metadata": {},
262    "source": [
263     "Demonstrate summing a range of integers from 0 to n-1.\n",
264     "\n",
265     "- `[P]` is `[0 <=]`\n",
266     "- `c` is `0`\n",
267     "- `[G]` is `[1 - dup]`\n",
268     "- `[F]` is `[+]`\n",
269     "\n",
270     "So to sum the positive integers less than five we can do this."
271    ]
272   },
273   {
274    "cell_type": "code",
275    "execution_count": 9,
276    "metadata": {},
277    "outputs": [
278     {
279      "name": "stdout",
280      "output_type": "stream",
281      "text": [
282       "                                                                               . 5 [0 <=] 0 [1 - dup] [+] hylomorphism\n",
283       "                                                                             5 . [0 <=] 0 [1 - dup] [+] hylomorphism\n",
284       "                                                                      5 [0 <=] . 0 [1 - dup] [+] hylomorphism\n",
285       "                                                                    5 [0 <=] 0 . [1 - dup] [+] hylomorphism\n",
286       "                                                          5 [0 <=] 0 [1 - dup] . [+] hylomorphism\n",
287       "                                                      5 [0 <=] 0 [1 - dup] [+] . hylomorphism\n",
288       "                                                      5 [0 <=] 0 [1 - dup] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
289       "                                 5 [0 <=] 0 [1 - dup] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec\n",
290       "                                                                    5 [0 <=] 0 . unit [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
291       "                                                                    5 [0 <=] 0 . [] cons [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
292       "                                                                 5 [0 <=] 0 [] . cons [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
293       "                                                                  5 [0 <=] [0] . [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
294       "                                                            5 [0 <=] [0] [pop] . swoncat [1 - dup] [+] [dip] swoncat genrec\n",
295       "                                                            5 [0 <=] [0] [pop] . swap concat [1 - dup] [+] [dip] swoncat genrec\n",
296       "                                                            5 [0 <=] [pop] [0] . concat [1 - dup] [+] [dip] swoncat genrec\n",
297       "                                                              5 [0 <=] [pop 0] . [1 - dup] [+] [dip] swoncat genrec\n",
298       "                                                    5 [0 <=] [pop 0] [1 - dup] . [+] [dip] swoncat genrec\n",
299       "                                                5 [0 <=] [pop 0] [1 - dup] [+] . [dip] swoncat genrec\n",
300       "                                          5 [0 <=] [pop 0] [1 - dup] [+] [dip] . swoncat genrec\n",
301       "                                          5 [0 <=] [pop 0] [1 - dup] [+] [dip] . swap concat genrec\n",
302       "                                          5 [0 <=] [pop 0] [1 - dup] [dip] [+] . concat genrec\n",
303       "                                            5 [0 <=] [pop 0] [1 - dup] [dip +] . genrec\n",
304       "    5 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte\n",
305       "5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [5] [0 <=] . infra first choice i\n",
306       "                                                                             5 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] swaack first choice i\n",
307       "                                                                           5 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] swaack first choice i\n",
308       "                                                                         False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] swaack first choice i\n",
309       "   False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] . swaack first choice i\n",
310       "   5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i\n",
311       "     5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i\n",
312       "                   5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i\n",
313       "                                                                             5 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
314       "                                                                           5 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
315       "                                                                             4 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
316       "                                                                           4 4 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
317       "                                 4 4 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip +\n",
318       "                                                                             4 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 4 +\n",
319       "                                                                      4 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 4 +\n",
320       "                                                              4 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 4 +\n",
321       "                                                    4 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 4 +\n",
322       "                                            4 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 4 +\n",
323       "    4 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 4 +\n",
324       "4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [4] [0 <=] . infra first choice i 4 +\n",
325       "                                                                             4 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] swaack first choice i 4 +\n",
326       "                                                                           4 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] swaack first choice i 4 +\n",
327       "                                                                         False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] swaack first choice i 4 +\n",
328       "   False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] . swaack first choice i 4 +\n",
329       "   4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 4 +\n",
330       "     4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 4 +\n",
331       "                   4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 4 +\n",
332       "                                                                             4 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 +\n",
333       "                                                                           4 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 +\n",
334       "                                                                             3 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 +\n",
335       "                                                                           3 3 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 +\n",
336       "                                 3 3 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 4 +\n",
337       "                                                                             3 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 3 + 4 +\n",
338       "                                                                      3 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 3 + 4 +\n",
339       "                                                              3 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 3 + 4 +\n",
340       "                                                    3 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 3 + 4 +\n",
341       "                                            3 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 3 + 4 +\n",
342       "    3 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 3 + 4 +\n",
343       "3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [3] [0 <=] . infra first choice i 3 + 4 +\n",
344       "                                                                             3 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] swaack first choice i 3 + 4 +\n",
345       "                                                                           3 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] swaack first choice i 3 + 4 +\n",
346       "                                                                         False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] swaack first choice i 3 + 4 +\n",
347       "   False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] . swaack first choice i 3 + 4 +\n",
348       "   3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 3 + 4 +\n",
349       "     3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 3 + 4 +\n",
350       "                   3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 3 + 4 +\n",
351       "                                                                             3 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 +\n",
352       "                                                                           3 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 +\n",
353       "                                                                             2 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 +\n",
354       "                                                                           2 2 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 +\n",
355       "                                 2 2 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 3 + 4 +\n",
356       "                                                                             2 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 2 + 3 + 4 +\n",
357       "                                                                      2 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 2 + 3 + 4 +\n",
358       "                                                              2 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 2 + 3 + 4 +\n",
359       "                                                    2 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 2 + 3 + 4 +\n",
360       "                                            2 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 2 + 3 + 4 +\n",
361       "    2 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 2 + 3 + 4 +\n",
362       "2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [2] [0 <=] . infra first choice i 2 + 3 + 4 +\n",
363       "                                                                             2 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] swaack first choice i 2 + 3 + 4 +\n",
364       "                                                                           2 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] swaack first choice i 2 + 3 + 4 +\n",
365       "                                                                         False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] swaack first choice i 2 + 3 + 4 +\n",
366       "   False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] . swaack first choice i 2 + 3 + 4 +\n",
367       "   2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 2 + 3 + 4 +\n",
368       "     2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 2 + 3 + 4 +\n",
369       "                   2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 2 + 3 + 4 +\n",
370       "                                                                             2 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 +\n",
371       "                                                                           2 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 +\n",
372       "                                                                             1 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 +\n",
373       "                                                                           1 1 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 +\n",
374       "                                 1 1 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 2 + 3 + 4 +\n",
375       "                                                                             1 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 1 + 2 + 3 + 4 +\n",
376       "                                                                      1 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 1 + 2 + 3 + 4 +\n",
377       "                                                              1 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 1 + 2 + 3 + 4 +\n",
378       "                                                    1 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 1 + 2 + 3 + 4 +\n",
379       "                                            1 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 1 + 2 + 3 + 4 +\n",
380       "    1 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 1 + 2 + 3 + 4 +\n",
381       "1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [1] [0 <=] . infra first choice i 1 + 2 + 3 + 4 +\n",
382       "                                                                             1 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] swaack first choice i 1 + 2 + 3 + 4 +\n",
383       "                                                                           1 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] swaack first choice i 1 + 2 + 3 + 4 +\n",
384       "                                                                         False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] swaack first choice i 1 + 2 + 3 + 4 +\n",
385       "   False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] . swaack first choice i 1 + 2 + 3 + 4 +\n",
386       "   1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 1 + 2 + 3 + 4 +\n",
387       "     1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 1 + 2 + 3 + 4 +\n",
388       "                   1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 1 + 2 + 3 + 4 +\n",
389       "                                                                             1 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 +\n",
390       "                                                                           1 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 +\n",
391       "                                                                             0 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 +\n",
392       "                                                                           0 0 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 +\n",
393       "                                 0 0 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 1 + 2 + 3 + 4 +\n",
394       "                                                                             0 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 0 + 1 + 2 + 3 + 4 +\n",
395       "                                                                      0 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 0 + 1 + 2 + 3 + 4 +\n",
396       "                                                              0 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 0 + 1 + 2 + 3 + 4 +\n",
397       "                                                    0 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 0 + 1 + 2 + 3 + 4 +\n",
398       "                                            0 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 0 + 1 + 2 + 3 + 4 +\n",
399       "    0 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 0 + 1 + 2 + 3 + 4 +\n",
400       "0 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [0] [0 <=] . infra first choice i 0 + 1 + 2 + 3 + 4 +\n",
401       "                                                                             0 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] swaack first choice i 0 + 1 + 2 + 3 + 4 +\n",
402       "                                                                           0 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] swaack first choice i 0 + 1 + 2 + 3 + 4 +\n",
403       "                                                                          True . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] swaack first choice i 0 + 1 + 2 + 3 + 4 +\n",
404       "    True [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] . swaack first choice i 0 + 1 + 2 + 3 + 4 +\n",
405       "    0 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [True] . first choice i 0 + 1 + 2 + 3 + 4 +\n",
406       "      0 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] True . choice i 0 + 1 + 2 + 3 + 4 +\n",
407       "                                                                     0 [pop 0] . i 0 + 1 + 2 + 3 + 4 +\n",
408       "                                                                             0 . pop 0 0 + 1 + 2 + 3 + 4 +\n",
409       "                                                                               . 0 0 + 1 + 2 + 3 + 4 +\n",
410       "                                                                             0 . 0 + 1 + 2 + 3 + 4 +\n",
411       "                                                                           0 0 . + 1 + 2 + 3 + 4 +\n",
412       "                                                                             0 . 1 + 2 + 3 + 4 +\n",
413       "                                                                           0 1 . + 2 + 3 + 4 +\n",
414       "                                                                             1 . 2 + 3 + 4 +\n",
415       "                                                                           1 2 . + 3 + 4 +\n",
416       "                                                                             3 . 3 + 4 +\n",
417       "                                                                           3 3 . + 4 +\n",
418       "                                                                             6 . 4 +\n",
419       "                                                                           6 4 . +\n",
420       "                                                                            10 . \n"
421      ]
422     }
423    ],
424    "source": [
425     "V('5 [0 <=] 0 [1 - dup] [+] hylomorphism')"
426    ]
427   },
428   {
429    "cell_type": "markdown",
430    "metadata": {},
431    "source": [
432     "# Anamorphism\n",
433     "An anamorphism can be defined as a hylomorphism that uses `[]` for `c` and\n",
434     "`swons` for `F`.\n",
435     "\n",
436     "    [P] [G] anamorphism == [P] [] [G] [swons] hylomorphism == A\n",
437     "\n",
438     "This allows us to define an anamorphism combinator in terms of\n",
439     "the hylomorphism combinator.\n",
440     "\n",
441     "    [] swap [swons] hylomorphism == anamorphism\n",
442     "\n",
443     "Partial evaluation gives us a \"pre-cooked\" form.\n",
444     "\n",
445     "    [P] [G] . anamorphism\n",
446     "    [P] [G] . [] swap [swons] hylomorphism\n",
447     "    [P] [G] [] . swap [swons] hylomorphism\n",
448     "    [P] [] [G] . [swons] hylomorphism\n",
449     "    [P] [] [G] [swons] . hylomorphism\n",
450     "    [P] [] [G] [swons] . [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
451     "    [P] [] [G] [swons] [unit [pop] swoncat] . dipd [dip] swoncat genrec\n",
452     "    [P] [] . unit [pop] swoncat [G] [swons] [dip] swoncat genrec\n",
453     "    [P] [[]] [pop] . swoncat [G] [swons] [dip] swoncat genrec\n",
454     "    [P] [pop []] [G] [swons] [dip] . swoncat genrec\n",
455     "\n",
456     "    [P] [pop []] [G] [dip swons] genrec\n",
457     "\n",
458     "(We could also have just substituted for `c` and `F` in the definition of `H`.)\n",
459     "\n",
460     "    H == [P] [pop c ] [G] [dip F    ] genrec\n",
461     "    A == [P] [pop []] [G] [dip swons] genrec\n",
462     "\n",
463     "The partial evaluation is overkill in this case but it serves as a\n",
464     "reminder that this sort of program specialization can, in many cases, be\n",
465     "carried out automatically.)\n",
466     "\n",
467     "Untangle `[G]` from `[pop []]` using `swap`.\n",
468     "\n",
469     "    [P] [G] [pop []] swap [dip swons] genrec\n",
470     "\n",
471     "All of the arguments to `anamorphism` are to the left, so we have a definition for it.\n",
472     "\n",
473     "    anamorphism == [pop []] swap [dip swons] genrec\n",
474     "\n",
475     "An example of an anamorphism is the range function.\n",
476     "\n",
477     "    range == [0 <=] [1 - dup] anamorphism\n"
478    ]
479   },
480   {
481    "cell_type": "markdown",
482    "metadata": {},
483    "source": [
484     "# Catamorphism\n",
485     "A catamorphism can be defined as a hylomorphism that uses `[uncons swap]` for `[G]`\n",
486     "and `[[] =]` for the predicate `[P]`.\n",
487     "\n",
488     "    c [F] catamorphism == [[] =] c [uncons swap] [F] hylomorphism == C\n",
489     "\n",
490     "This allows us to define a `catamorphism` combinator in terms of\n",
491     "the `hylomorphism` combinator.\n",
492     "\n",
493     "    [[] =] roll> [uncons swap] swap hylomorphism == catamorphism\n",
494     " \n",
495     "Partial evaluation doesn't help much.\n",
496     "\n",
497     "    c [F] . catamorphism\n",
498     "    c [F] . [[] =] roll> [uncons swap] swap hylomorphism\n",
499     "    c [F] [[] =] . roll> [uncons swap] swap hylomorphism\n",
500     "    [[] =] c [F] [uncons swap] . swap hylomorphism\n",
501     "    [[] =] c [uncons swap] [F] . hylomorphism\n",
502     "    [[] =] c [uncons swap] [F] [unit [pop] swoncat] . dipd [dip] swoncat genrec\n",
503     "    [[] =] c . unit [pop] swoncat [uncons swap] [F] [dip] swoncat genrec\n",
504     "    [[] =] [c] [pop] . swoncat [uncons swap] [F] [dip] swoncat genrec\n",
505     "    [[] =] [pop c] [uncons swap] [F] [dip] . swoncat genrec\n",
506     "    [[] =] [pop c] [uncons swap] [dip F] genrec\n",
507     "\n",
508     "Because the arguments to catamorphism have to be prepared (unlike the arguments\n",
509     "to anamorphism, which only need to be rearranged slightly) there isn't much point\n",
510     "to \"pre-cooking\" the definition.\n",
511     "\n",
512     "    catamorphism == [[] =] roll> [uncons swap] swap hylomorphism\n",
513     "\n",
514     "An example of a catamorphism is the sum function.\n",
515     "\n",
516     "    sum == 0 [+] catamorphism"
517    ]
518   },
519   {
520    "cell_type": "markdown",
521    "metadata": {},
522    "source": [
523     "### \"Fusion Law\" for catas (UNFINISHED!!!)\n",
524     "\n",
525     "I'm not sure exactly how to translate the \"Fusion Law\" for catamorphisms into Joy.\n",
526     "\n",
527     "I know that a `map` composed with a cata can be expressed as a new cata:\n",
528     "\n",
529     "    [F] map b [B] cata == b [F B] cata\n",
530     "\n",
531     "But this isn't the one described in \"Bananas...\".  That's more like:\n",
532     "\n",
533     "A cata composed with some function can be expressed as some other cata:\n",
534     "\n",
535     "    b [B] catamorphism F == c [C] catamorphism\n",
536     "\n",
537     "Given:\n",
538     "\n",
539     "    b F == c\n",
540     "\n",
541     "    ...\n",
542     "\n",
543     "    B F == [F] dip C\n",
544     "\n",
545     "    ...\n",
546     "\n",
547     "    b[B]cata F == c[C]cata\n",
548     "\n",
549     "    F(B(head, tail)) == C(head, F(tail))\n",
550     "\n",
551     "    1 [2 3] B F         1 [2 3] F C\n",
552     "\n",
553     "\n",
554     "    b F == c\n",
555     "    B F == F C\n",
556     "\n",
557     "    b [B] catamorphism F == c [C] catamorphism\n",
558     "    b [B] catamorphism F == b F [C] catamorphism\n",
559     "\n",
560     "    ...\n",
561     "\n",
562     "Or maybe,\n",
563     "\n",
564     "    [F] map b [B] cata == c [C] cata     ???\n",
565     "\n",
566     "    [F] map b [B] cata == b [F B] cata    I think this is generally true, unless F consumes stack items\n",
567     "                                            instead of just transforming TOS.  Of course, there's always [F] unary.\n",
568     "    b [F] unary [[F] unary B] cata\n",
569     "\n",
570     "    [10 *] map 0 swap [+] step == 0 swap [10 * +] step\n",
571     "\n",
572     "\n",
573     "For example:\n",
574     "\n",
575     "    F == 10 *\n",
576     "    b == 0\n",
577     "    B == +\n",
578     "    c == 0\n",
579     "    C == F +\n",
580     "    \n",
581     "    b F    == c\n",
582     "    0 10 * == 0\n",
583     "\n",
584     "    B F    == [F]    dip C\n",
585     "    + 10 * == [10 *] dip F +\n",
586     "    + 10 * == [10 *] dip 10 * +\n",
587     "\n",
588     "    n m + 10 * == 10(n+m)\n",
589     "\n",
590     "    n m [10 *] dip 10 * +\n",
591     "    n 10 * m 10 * +\n",
592     "    10n m 10 * +\n",
593     "    10n 10m +\n",
594     "    10n+10m\n",
595     "\n",
596     "    10n+10m = 10(n+m)\n",
597     "\n",
598     "Ergo:\n",
599     "\n",
600     "    0 [+] catamorphism 10 * == 0 [10 * +] catamorphism"
601    ]
602   },
603   {
604    "cell_type": "markdown",
605    "metadata": {},
606    "source": [
607     "## The `step` combinator will usually be better to use than `catamorphism`.\n",
608     "\n",
609     "    sum == 0 swap [+] step\n",
610     "    sum == 0 [+] catamorphism"
611    ]
612   },
613   {
614    "cell_type": "markdown",
615    "metadata": {},
616    "source": [
617     "# anamorphism catamorphism == hylomorphism\n",
618     "Here is (part of) the payoff.\n",
619     "\n",
620     "An anamorphism followed by (composed with) a\n",
621     "catamorphism is a hylomorphism, with the advantage that the hylomorphism \n",
622     "does not create the intermediate list structure.  The values are stored in\n",
623     "either the call stack, for those implementations that use one, or in the pending\n",
624     "expression (\"continuation\") for the Joypy interpreter.  They still have to \n",
625     "be somewhere, converting from an anamorphism and catamorphism to a hylomorphism\n",
626     "just prevents using additional storage and doing additional processing.\n",
627     "\n",
628     "        range == [0 <=] [1 - dup] anamorphism\n",
629     "          sum == 0 [+] catamorphism\n",
630     "\n",
631     "    range sum == [0 <=] [1 - dup] anamorphism 0 [+] catamorphism\n",
632     "              == [0 <=] 0 [1 - dup] [+] hylomorphism\n",
633     "\n",
634     "We can let the `hylomorphism` combinator build `range_sum` for us or just\n",
635     "substitute ourselves.\n",
636     "\n",
637     "            H == [P]    [pop c] [G]       [dip F] genrec\n",
638     "    range_sum == [0 <=] [pop 0] [1 - dup] [dip +] genrec\n"
639    ]
640   },
641   {
642    "cell_type": "code",
643    "execution_count": 10,
644    "metadata": {},
645    "outputs": [],
646    "source": [
647     "defs = '''\n",
648     "anamorphism == [pop []] swap [dip swons] genrec\n",
649     "hylomorphism == [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
650     "catamorphism == [[] =] roll> [uncons swap] swap hylomorphism\n",
651     "range == [0 <=] [1 - dup] anamorphism\n",
652     "sum == 0 [+] catamorphism\n",
653     "range_sum == [0 <=] 0 [1 - dup] [+] hylomorphism\n",
654     "'''\n",
655     "\n",
656     "DefinitionWrapper.add_definitions(defs, D)"
657    ]
658   },
659   {
660    "cell_type": "code",
661    "execution_count": 11,
662    "metadata": {},
663    "outputs": [
664     {
665      "name": "stdout",
666      "output_type": "stream",
667      "text": [
668       "[9 8 7 6 5 4 3 2 1 0]\n"
669      ]
670     }
671    ],
672    "source": [
673     "J('10 range')"
674    ]
675   },
676   {
677    "cell_type": "code",
678    "execution_count": 12,
679    "metadata": {},
680    "outputs": [
681     {
682      "name": "stdout",
683      "output_type": "stream",
684      "text": [
685       "45\n"
686      ]
687     }
688    ],
689    "source": [
690     "J('[9 8 7 6 5 4 3 2 1 0] sum')"
691    ]
692   },
693   {
694    "cell_type": "code",
695    "execution_count": 13,
696    "metadata": {},
697    "outputs": [
698     {
699      "name": "stdout",
700      "output_type": "stream",
701      "text": [
702       "                                                                                                                               . 10 range sum\n",
703       "                                                                                                                            10 . range sum\n",
704       "                                                                                                                            10 . [0 <=] [1 - dup] anamorphism sum\n",
705       "                                                                                                                     10 [0 <=] . [1 - dup] anamorphism sum\n",
706       "                                                                                                           10 [0 <=] [1 - dup] . anamorphism sum\n",
707       "                                                                                                           10 [0 <=] [1 - dup] . [pop []] swap [dip swons] genrec sum\n",
708       "                                                                                                  10 [0 <=] [1 - dup] [pop []] . swap [dip swons] genrec sum\n",
709       "                                                                                                  10 [0 <=] [pop []] [1 - dup] . [dip swons] genrec sum\n",
710       "                                                                                      10 [0 <=] [pop []] [1 - dup] [dip swons] . genrec sum\n",
711       "                                         10 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte sum\n",
712       "                                    10 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [10] [0 <=] . infra first choice i sum\n",
713       "                                                                                                                            10 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 10] swaack first choice i sum\n",
714       "                                                                                                                          10 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 10] swaack first choice i sum\n",
715       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 10] swaack first choice i sum\n",
716       "                                        False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 10] . swaack first choice i sum\n",
717       "                                        10 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i sum\n",
718       "                                          10 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i sum\n",
719       "                                                         10 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i sum\n",
720       "                                                                                                                            10 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons sum\n",
721       "                                                                                                                          10 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons sum\n",
722       "                                                                                                                             9 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons sum\n",
723       "                                                                                                                           9 9 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons sum\n",
724       "                                                                            9 9 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons sum\n",
725       "                                                                                                                             9 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 9 swons sum\n",
726       "                                                                                                                      9 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 9 swons sum\n",
727       "                                                                                                             9 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 9 swons sum\n",
728       "                                                                                                   9 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 9 swons sum\n",
729       "                                                                                       9 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 9 swons sum\n",
730       "                                          9 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 9 swons sum\n",
731       "                                      9 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [9] [0 <=] . infra first choice i 9 swons sum\n",
732       "                                                                                                                             9 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 9] swaack first choice i 9 swons sum\n",
733       "                                                                                                                           9 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 9] swaack first choice i 9 swons sum\n",
734       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 9] swaack first choice i 9 swons sum\n",
735       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 9] . swaack first choice i 9 swons sum\n",
736       "                                         9 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 9 swons sum\n",
737       "                                           9 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 9 swons sum\n",
738       "                                                          9 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 9 swons sum\n",
739       "                                                                                                                             9 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 9 swons sum\n",
740       "                                                                                                                           9 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 9 swons sum\n",
741       "                                                                                                                             8 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 9 swons sum\n",
742       "                                                                                                                           8 8 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 9 swons sum\n",
743       "                                                                            8 8 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 9 swons sum\n",
744       "                                                                                                                             8 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 8 swons 9 swons sum\n",
745       "                                                                                                                      8 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 8 swons 9 swons sum\n",
746       "                                                                                                             8 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 8 swons 9 swons sum\n",
747       "                                                                                                   8 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 8 swons 9 swons sum\n",
748       "                                                                                       8 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 8 swons 9 swons sum\n",
749       "                                          8 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 8 swons 9 swons sum\n",
750       "                                      8 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [8] [0 <=] . infra first choice i 8 swons 9 swons sum\n",
751       "                                                                                                                             8 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 8] swaack first choice i 8 swons 9 swons sum\n",
752       "                                                                                                                           8 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 8] swaack first choice i 8 swons 9 swons sum\n",
753       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 8] swaack first choice i 8 swons 9 swons sum\n",
754       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 8] . swaack first choice i 8 swons 9 swons sum\n",
755       "                                         8 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 8 swons 9 swons sum\n",
756       "                                           8 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 8 swons 9 swons sum\n",
757       "                                                          8 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 8 swons 9 swons sum\n",
758       "                                                                                                                             8 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 8 swons 9 swons sum\n",
759       "                                                                                                                           8 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 8 swons 9 swons sum\n",
760       "                                                                                                                             7 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 8 swons 9 swons sum\n",
761       "                                                                                                                           7 7 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 8 swons 9 swons sum\n",
762       "                                                                            7 7 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 8 swons 9 swons sum\n",
763       "                                                                                                                             7 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 7 swons 8 swons 9 swons sum\n",
764       "                                                                                                                      7 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 7 swons 8 swons 9 swons sum\n",
765       "                                                                                                             7 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 7 swons 8 swons 9 swons sum\n",
766       "                                                                                                   7 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 7 swons 8 swons 9 swons sum\n",
767       "                                                                                       7 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 7 swons 8 swons 9 swons sum\n",
768       "                                          7 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 7 swons 8 swons 9 swons sum\n",
769       "                                      7 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [7] [0 <=] . infra first choice i 7 swons 8 swons 9 swons sum\n",
770       "                                                                                                                             7 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 7] swaack first choice i 7 swons 8 swons 9 swons sum\n",
771       "                                                                                                                           7 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 7] swaack first choice i 7 swons 8 swons 9 swons sum\n",
772       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 7] swaack first choice i 7 swons 8 swons 9 swons sum\n",
773       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 7] . swaack first choice i 7 swons 8 swons 9 swons sum\n",
774       "                                         7 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 7 swons 8 swons 9 swons sum\n",
775       "                                           7 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 7 swons 8 swons 9 swons sum\n",
776       "                                                          7 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 7 swons 8 swons 9 swons sum\n",
777       "                                                                                                                             7 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 7 swons 8 swons 9 swons sum\n",
778       "                                                                                                                           7 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 7 swons 8 swons 9 swons sum\n",
779       "                                                                                                                             6 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 7 swons 8 swons 9 swons sum\n",
780       "                                                                                                                           6 6 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 7 swons 8 swons 9 swons sum\n",
781       "                                                                            6 6 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 7 swons 8 swons 9 swons sum\n",
782       "                                                                                                                             6 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 6 swons 7 swons 8 swons 9 swons sum\n",
783       "                                                                                                                      6 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 6 swons 7 swons 8 swons 9 swons sum\n",
784       "                                                                                                             6 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 6 swons 7 swons 8 swons 9 swons sum\n",
785       "                                                                                                   6 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 6 swons 7 swons 8 swons 9 swons sum\n",
786       "                                                                                       6 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 6 swons 7 swons 8 swons 9 swons sum\n",
787       "                                          6 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 6 swons 7 swons 8 swons 9 swons sum\n",
788       "                                      6 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [6] [0 <=] . infra first choice i 6 swons 7 swons 8 swons 9 swons sum\n",
789       "                                                                                                                             6 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 6] swaack first choice i 6 swons 7 swons 8 swons 9 swons sum\n",
790       "                                                                                                                           6 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 6] swaack first choice i 6 swons 7 swons 8 swons 9 swons sum\n",
791       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 6] swaack first choice i 6 swons 7 swons 8 swons 9 swons sum\n",
792       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 6] . swaack first choice i 6 swons 7 swons 8 swons 9 swons sum\n",
793       "                                         6 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 6 swons 7 swons 8 swons 9 swons sum\n",
794       "                                           6 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 6 swons 7 swons 8 swons 9 swons sum\n",
795       "                                                          6 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 6 swons 7 swons 8 swons 9 swons sum\n",
796       "                                                                                                                             6 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 6 swons 7 swons 8 swons 9 swons sum\n",
797       "                                                                                                                           6 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 6 swons 7 swons 8 swons 9 swons sum\n",
798       "                                                                                                                             5 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 6 swons 7 swons 8 swons 9 swons sum\n",
799       "                                                                                                                           5 5 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 6 swons 7 swons 8 swons 9 swons sum\n",
800       "                                                                            5 5 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 6 swons 7 swons 8 swons 9 swons sum\n",
801       "                                                                                                                             5 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
802       "                                                                                                                      5 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
803       "                                                                                                             5 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
804       "                                                                                                   5 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
805       "                                                                                       5 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
806       "                                          5 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
807       "                                      5 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [5] [0 <=] . infra first choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
808       "                                                                                                                             5 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 5] swaack first choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
809       "                                                                                                                           5 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 5] swaack first choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
810       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 5] swaack first choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
811       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 5] . swaack first choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
812       "                                         5 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
813       "                                           5 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
814       "                                                          5 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
815       "                                                                                                                             5 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
816       "                                                                                                                           5 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
817       "                                                                                                                             4 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
818       "                                                                                                                           4 4 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
819       "                                                                            4 4 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
820       "                                                                                                                             4 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
821       "                                                                                                                      4 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
822       "                                                                                                             4 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
823       "                                                                                                   4 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
824       "                                                                                       4 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
825       "                                          4 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
826       "                                      4 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [4] [0 <=] . infra first choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
827       "                                                                                                                             4 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 4] swaack first choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
828       "                                                                                                                           4 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 4] swaack first choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
829       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 4] swaack first choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
830       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 4] . swaack first choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
831       "                                         4 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
832       "                                           4 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
833       "                                                          4 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
834       "                                                                                                                             4 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
835       "                                                                                                                           4 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
836       "                                                                                                                             3 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
837       "                                                                                                                           3 3 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
838       "                                                                            3 3 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
839       "                                                                                                                             3 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
840       "                                                                                                                      3 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
841       "                                                                                                             3 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
842       "                                                                                                   3 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
843       "                                                                                       3 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
844       "                                          3 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
845       "                                      3 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [3] [0 <=] . infra first choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
846       "                                                                                                                             3 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 3] swaack first choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
847       "                                                                                                                           3 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 3] swaack first choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
848       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 3] swaack first choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
849       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 3] . swaack first choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
850       "                                         3 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
851       "                                           3 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
852       "                                                          3 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
853       "                                                                                                                             3 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
854       "                                                                                                                           3 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
855       "                                                                                                                             2 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
856       "                                                                                                                           2 2 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
857       "                                                                            2 2 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
858       "                                                                                                                             2 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
859       "                                                                                                                      2 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
860       "                                                                                                             2 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
861       "                                                                                                   2 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
862       "                                                                                       2 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
863       "                                          2 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
864       "                                      2 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [2] [0 <=] . infra first choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
865       "                                                                                                                             2 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
866       "                                                                                                                           2 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
867       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
868       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 2] . swaack first choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
869       "                                         2 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
870       "                                           2 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
871       "                                                          2 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
872       "                                                                                                                             2 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
873       "                                                                                                                           2 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
874       "                                                                                                                             1 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
875       "                                                                                                                           1 1 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
876       "                                                                            1 1 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
877       "                                                                                                                             1 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
878       "                                                                                                                      1 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
879       "                                                                                                             1 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
880       "                                                                                                   1 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
881       "                                                                                       1 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
882       "                                          1 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
883       "                                      1 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [1] [0 <=] . infra first choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
884       "                                                                                                                             1 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
885       "                                                                                                                           1 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
886       "                                                                                                                         False . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
887       "                                         False [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 1] . swaack first choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
888       "                                         1 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
889       "                                           1 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] False . choice i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
890       "                                                          1 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . i 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
891       "                                                                                                                             1 . 1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
892       "                                                                                                                           1 1 . - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
893       "                                                                                                                             0 . dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
894       "                                                                                                                           0 0 . [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
895       "                                                                            0 0 [[0 <=] [pop []] [1 - dup] [dip swons] genrec] . dip swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
896       "                                                                                                                             0 . [0 <=] [pop []] [1 - dup] [dip swons] genrec 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
897       "                                                                                                                      0 [0 <=] . [pop []] [1 - dup] [dip swons] genrec 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
898       "                                                                                                             0 [0 <=] [pop []] . [1 - dup] [dip swons] genrec 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
899       "                                                                                                   0 [0 <=] [pop []] [1 - dup] . [dip swons] genrec 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
900       "                                                                                       0 [0 <=] [pop []] [1 - dup] [dip swons] . genrec 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
901       "                                          0 [0 <=] [pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] . ifte 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
902       "                                      0 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [0] [0 <=] . infra first choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
903       "                                                                                                                             0 . 0 <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 0] swaack first choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
904       "                                                                                                                           0 0 . <= [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 0] swaack first choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
905       "                                                                                                                          True . [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 0] swaack first choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
906       "                                          True [[pop []] [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] 0] . swaack first choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
907       "                                          0 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] [True] . first choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
908       "                                            0 [1 - dup [[0 <=] [pop []] [1 - dup] [dip swons] genrec] dip swons] [pop []] True . choice i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
909       "                                                                                                                    0 [pop []] . i 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
910       "                                                                                                                             0 . pop [] 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
911       "                                                                                                                               . [] 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
912       "                                                                                                                            [] . 0 swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
913       "                                                                                                                          [] 0 . swons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
914       "                                                                                                                          [] 0 . swap cons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
915       "                                                                                                                          0 [] . cons 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
916       "                                                                                                                           [0] . 1 swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
917       "                                                                                                                         [0] 1 . swons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
918       "                                                                                                                         [0] 1 . swap cons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
919       "                                                                                                                         1 [0] . cons 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
920       "                                                                                                                         [1 0] . 2 swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
921       "                                                                                                                       [1 0] 2 . swons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
922       "                                                                                                                       [1 0] 2 . swap cons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
923       "                                                                                                                       2 [1 0] . cons 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
924       "                                                                                                                       [2 1 0] . 3 swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
925       "                                                                                                                     [2 1 0] 3 . swons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
926       "                                                                                                                     [2 1 0] 3 . swap cons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
927       "                                                                                                                     3 [2 1 0] . cons 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
928       "                                                                                                                     [3 2 1 0] . 4 swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
929       "                                                                                                                   [3 2 1 0] 4 . swons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
930       "                                                                                                                   [3 2 1 0] 4 . swap cons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
931       "                                                                                                                   4 [3 2 1 0] . cons 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
932       "                                                                                                                   [4 3 2 1 0] . 5 swons 6 swons 7 swons 8 swons 9 swons sum\n",
933       "                                                                                                                 [4 3 2 1 0] 5 . swons 6 swons 7 swons 8 swons 9 swons sum\n",
934       "                                                                                                                 [4 3 2 1 0] 5 . swap cons 6 swons 7 swons 8 swons 9 swons sum\n",
935       "                                                                                                                 5 [4 3 2 1 0] . cons 6 swons 7 swons 8 swons 9 swons sum\n",
936       "                                                                                                                 [5 4 3 2 1 0] . 6 swons 7 swons 8 swons 9 swons sum\n",
937       "                                                                                                               [5 4 3 2 1 0] 6 . swons 7 swons 8 swons 9 swons sum\n",
938       "                                                                                                               [5 4 3 2 1 0] 6 . swap cons 7 swons 8 swons 9 swons sum\n",
939       "                                                                                                               6 [5 4 3 2 1 0] . cons 7 swons 8 swons 9 swons sum\n",
940       "                                                                                                               [6 5 4 3 2 1 0] . 7 swons 8 swons 9 swons sum\n",
941       "                                                                                                             [6 5 4 3 2 1 0] 7 . swons 8 swons 9 swons sum\n",
942       "                                                                                                             [6 5 4 3 2 1 0] 7 . swap cons 8 swons 9 swons sum\n",
943       "                                                                                                             7 [6 5 4 3 2 1 0] . cons 8 swons 9 swons sum\n",
944       "                                                                                                             [7 6 5 4 3 2 1 0] . 8 swons 9 swons sum\n",
945       "                                                                                                           [7 6 5 4 3 2 1 0] 8 . swons 9 swons sum\n",
946       "                                                                                                           [7 6 5 4 3 2 1 0] 8 . swap cons 9 swons sum\n",
947       "                                                                                                           8 [7 6 5 4 3 2 1 0] . cons 9 swons sum\n",
948       "                                                                                                           [8 7 6 5 4 3 2 1 0] . 9 swons sum\n",
949       "                                                                                                         [8 7 6 5 4 3 2 1 0] 9 . swons sum\n",
950       "                                                                                                         [8 7 6 5 4 3 2 1 0] 9 . swap cons sum\n",
951       "                                                                                                         9 [8 7 6 5 4 3 2 1 0] . cons sum\n",
952       "                                                                                                         [9 8 7 6 5 4 3 2 1 0] . sum\n",
953       "                                                                                                         [9 8 7 6 5 4 3 2 1 0] . 0 [+] catamorphism\n",
954       "                                                                                                       [9 8 7 6 5 4 3 2 1 0] 0 . [+] catamorphism\n",
955       "                                                                                                   [9 8 7 6 5 4 3 2 1 0] 0 [+] . catamorphism\n",
956       "                                                                                                   [9 8 7 6 5 4 3 2 1 0] 0 [+] . [[] =] roll> [uncons swap] swap hylomorphism\n",
957       "                                                                                            [9 8 7 6 5 4 3 2 1 0] 0 [+] [[] =] . roll> [uncons swap] swap hylomorphism\n",
958       "                                                                                            [9 8 7 6 5 4 3 2 1 0] [[] =] 0 [+] . [uncons swap] swap hylomorphism\n",
959       "                                                                              [9 8 7 6 5 4 3 2 1 0] [[] =] 0 [+] [uncons swap] . swap hylomorphism\n",
960       "                                                                              [9 8 7 6 5 4 3 2 1 0] [[] =] 0 [uncons swap] [+] . hylomorphism\n",
961       "                                                                              [9 8 7 6 5 4 3 2 1 0] [[] =] 0 [uncons swap] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
962       "                                                         [9 8 7 6 5 4 3 2 1 0] [[] =] 0 [uncons swap] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec\n",
963       "                                                                                                [9 8 7 6 5 4 3 2 1 0] [[] =] 0 . unit [pop] swoncat [uncons swap] [+] [dip] swoncat genrec\n",
964       "                                                                                                [9 8 7 6 5 4 3 2 1 0] [[] =] 0 . [] cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec\n",
965       "                                                                                             [9 8 7 6 5 4 3 2 1 0] [[] =] 0 [] . cons [pop] swoncat [uncons swap] [+] [dip] swoncat genrec\n",
966       "                                                                                              [9 8 7 6 5 4 3 2 1 0] [[] =] [0] . [pop] swoncat [uncons swap] [+] [dip] swoncat genrec\n",
967       "                                                                                        [9 8 7 6 5 4 3 2 1 0] [[] =] [0] [pop] . swoncat [uncons swap] [+] [dip] swoncat genrec\n",
968       "                                                                                        [9 8 7 6 5 4 3 2 1 0] [[] =] [0] [pop] . swap concat [uncons swap] [+] [dip] swoncat genrec\n",
969       "                                                                                        [9 8 7 6 5 4 3 2 1 0] [[] =] [pop] [0] . concat [uncons swap] [+] [dip] swoncat genrec\n",
970       "                                                                                          [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] . [uncons swap] [+] [dip] swoncat genrec\n",
971       "                                                                            [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] . [+] [dip] swoncat genrec\n",
972       "                                                                        [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [+] . [dip] swoncat genrec\n",
973       "                                                                  [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [+] [dip] . swoncat genrec\n",
974       "                                                                  [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [+] [dip] . swap concat genrec\n",
975       "                                                                  [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip] [+] . concat genrec\n",
976       "                                                                    [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec\n",
977       "                        [9 8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte\n",
978       "[9 8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[9 8 7 6 5 4 3 2 1 0]] [[] =] . infra first choice i\n",
979       "                                                                                                         [9 8 7 6 5 4 3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [9 8 7 6 5 4 3 2 1 0]] swaack first choice i\n",
980       "                                                                                                      [9 8 7 6 5 4 3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [9 8 7 6 5 4 3 2 1 0]] swaack first choice i\n",
981       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [9 8 7 6 5 4 3 2 1 0]] swaack first choice i\n",
982       "                       False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [9 8 7 6 5 4 3 2 1 0]] . swaack first choice i\n",
983       "                       [9 8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i\n",
984       "                         [9 8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i\n",
985       "                                       [9 8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i\n",
986       "                                                                                                         [9 8 7 6 5 4 3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +\n",
987       "                                                                                                         9 [8 7 6 5 4 3 2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +\n",
988       "                                                                                                         [8 7 6 5 4 3 2 1 0] 9 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +\n",
989       "                                                           [8 7 6 5 4 3 2 1 0] 9 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip +\n",
990       "                                                                                                           [8 7 6 5 4 3 2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 9 +\n",
991       "                                                                                                    [8 7 6 5 4 3 2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 9 +\n",
992       "                                                                                            [8 7 6 5 4 3 2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 9 +\n",
993       "                                                                              [8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 9 +\n",
994       "                                                                      [8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 9 +\n",
995       "                          [8 7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 9 +\n",
996       "    [8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[8 7 6 5 4 3 2 1 0]] [[] =] . infra first choice i 9 +\n",
997       "                                                                                                           [8 7 6 5 4 3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [8 7 6 5 4 3 2 1 0]] swaack first choice i 9 +\n",
998       "                                                                                                        [8 7 6 5 4 3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [8 7 6 5 4 3 2 1 0]] swaack first choice i 9 +\n",
999       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [8 7 6 5 4 3 2 1 0]] swaack first choice i 9 +\n",
1000       "                         False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [8 7 6 5 4 3 2 1 0]] . swaack first choice i 9 +\n",
1001       "                         [8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 9 +\n",
1002       "                           [8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 9 +\n",
1003       "                                         [8 7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 9 +\n",
1004       "                                                                                                           [8 7 6 5 4 3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 9 +\n",
1005       "                                                                                                           8 [7 6 5 4 3 2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 9 +\n",
1006       "                                                                                                           [7 6 5 4 3 2 1 0] 8 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 9 +\n",
1007       "                                                             [7 6 5 4 3 2 1 0] 8 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 9 +\n",
1008       "                                                                                                             [7 6 5 4 3 2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 8 + 9 +\n",
1009       "                                                                                                      [7 6 5 4 3 2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 8 + 9 +\n",
1010       "                                                                                              [7 6 5 4 3 2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 8 + 9 +\n",
1011       "                                                                                [7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 8 + 9 +\n",
1012       "                                                                        [7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 8 + 9 +\n",
1013       "                            [7 6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 8 + 9 +\n",
1014       "        [7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[7 6 5 4 3 2 1 0]] [[] =] . infra first choice i 8 + 9 +\n",
1015       "                                                                                                             [7 6 5 4 3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [7 6 5 4 3 2 1 0]] swaack first choice i 8 + 9 +\n",
1016       "                                                                                                          [7 6 5 4 3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [7 6 5 4 3 2 1 0]] swaack first choice i 8 + 9 +\n",
1017       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [7 6 5 4 3 2 1 0]] swaack first choice i 8 + 9 +\n",
1018       "                           False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [7 6 5 4 3 2 1 0]] . swaack first choice i 8 + 9 +\n",
1019       "                           [7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 8 + 9 +\n",
1020       "                             [7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 8 + 9 +\n",
1021       "                                           [7 6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 8 + 9 +\n",
1022       "                                                                                                             [7 6 5 4 3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 8 + 9 +\n",
1023       "                                                                                                             7 [6 5 4 3 2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 8 + 9 +\n",
1024       "                                                                                                             [6 5 4 3 2 1 0] 7 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 8 + 9 +\n",
1025       "                                                               [6 5 4 3 2 1 0] 7 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 8 + 9 +\n",
1026       "                                                                                                               [6 5 4 3 2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 7 + 8 + 9 +\n",
1027       "                                                                                                        [6 5 4 3 2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 7 + 8 + 9 +\n",
1028       "                                                                                                [6 5 4 3 2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 7 + 8 + 9 +\n",
1029       "                                                                                  [6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 7 + 8 + 9 +\n",
1030       "                                                                          [6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 7 + 8 + 9 +\n",
1031       "                              [6 5 4 3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 7 + 8 + 9 +\n",
1032       "            [6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[6 5 4 3 2 1 0]] [[] =] . infra first choice i 7 + 8 + 9 +\n",
1033       "                                                                                                               [6 5 4 3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [6 5 4 3 2 1 0]] swaack first choice i 7 + 8 + 9 +\n",
1034       "                                                                                                            [6 5 4 3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [6 5 4 3 2 1 0]] swaack first choice i 7 + 8 + 9 +\n",
1035       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [6 5 4 3 2 1 0]] swaack first choice i 7 + 8 + 9 +\n",
1036       "                             False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [6 5 4 3 2 1 0]] . swaack first choice i 7 + 8 + 9 +\n",
1037       "                             [6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 7 + 8 + 9 +\n",
1038       "                               [6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 7 + 8 + 9 +\n",
1039       "                                             [6 5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 7 + 8 + 9 +\n",
1040       "                                                                                                               [6 5 4 3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1041       "                                                                                                               6 [5 4 3 2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1042       "                                                                                                               [5 4 3 2 1 0] 6 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1043       "                                                                 [5 4 3 2 1 0] 6 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 7 + 8 + 9 +\n",
1044       "                                                                                                                 [5 4 3 2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 6 + 7 + 8 + 9 +\n",
1045       "                                                                                                          [5 4 3 2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 6 + 7 + 8 + 9 +\n",
1046       "                                                                                                  [5 4 3 2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 6 + 7 + 8 + 9 +\n",
1047       "                                                                                    [5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 6 + 7 + 8 + 9 +\n",
1048       "                                                                            [5 4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 6 + 7 + 8 + 9 +\n",
1049       "                                [5 4 3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 6 + 7 + 8 + 9 +\n",
1050       "                [5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[5 4 3 2 1 0]] [[] =] . infra first choice i 6 + 7 + 8 + 9 +\n",
1051       "                                                                                                                 [5 4 3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [5 4 3 2 1 0]] swaack first choice i 6 + 7 + 8 + 9 +\n",
1052       "                                                                                                              [5 4 3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [5 4 3 2 1 0]] swaack first choice i 6 + 7 + 8 + 9 +\n",
1053       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [5 4 3 2 1 0]] swaack first choice i 6 + 7 + 8 + 9 +\n",
1054       "                               False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [5 4 3 2 1 0]] . swaack first choice i 6 + 7 + 8 + 9 +\n",
1055       "                               [5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 6 + 7 + 8 + 9 +\n",
1056       "                                 [5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 6 + 7 + 8 + 9 +\n",
1057       "                                               [5 4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 6 + 7 + 8 + 9 +\n",
1058       "                                                                                                                 [5 4 3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1059       "                                                                                                                 5 [4 3 2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1060       "                                                                                                                 [4 3 2 1 0] 5 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1061       "                                                                   [4 3 2 1 0] 5 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 6 + 7 + 8 + 9 +\n",
1062       "                                                                                                                   [4 3 2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1063       "                                                                                                            [4 3 2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1064       "                                                                                                    [4 3 2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1065       "                                                                                      [4 3 2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1066       "                                                                              [4 3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 5 + 6 + 7 + 8 + 9 +\n",
1067       "                                  [4 3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 5 + 6 + 7 + 8 + 9 +\n",
1068       "                    [4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[4 3 2 1 0]] [[] =] . infra first choice i 5 + 6 + 7 + 8 + 9 +\n",
1069       "                                                                                                                   [4 3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [4 3 2 1 0]] swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1070       "                                                                                                                [4 3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [4 3 2 1 0]] swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1071       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [4 3 2 1 0]] swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1072       "                                 False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [4 3 2 1 0]] . swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1073       "                                 [4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 5 + 6 + 7 + 8 + 9 +\n",
1074       "                                   [4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 5 + 6 + 7 + 8 + 9 +\n",
1075       "                                                 [4 3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 5 + 6 + 7 + 8 + 9 +\n",
1076       "                                                                                                                   [4 3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1077       "                                                                                                                   4 [3 2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1078       "                                                                                                                   [3 2 1 0] 4 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1079       "                                                                     [3 2 1 0] 4 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 5 + 6 + 7 + 8 + 9 +\n",
1080       "                                                                                                                     [3 2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1081       "                                                                                                              [3 2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1082       "                                                                                                      [3 2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1083       "                                                                                        [3 2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1084       "                                                                                [3 2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1085       "                                    [3 2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 4 + 5 + 6 + 7 + 8 + 9 +\n",
1086       "                        [3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[3 2 1 0]] [[] =] . infra first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1087       "                                                                                                                     [3 2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3 2 1 0]] swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1088       "                                                                                                                  [3 2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3 2 1 0]] swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1089       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3 2 1 0]] swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1090       "                                   False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [3 2 1 0]] . swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1091       "                                   [3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1092       "                                     [3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1093       "                                                   [3 2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1094       "                                                                                                                     [3 2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1095       "                                                                                                                     3 [2 1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1096       "                                                                                                                     [2 1 0] 3 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1097       "                                                                       [2 1 0] 3 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1098       "                                                                                                                       [2 1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1099       "                                                                                                                [2 1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1100       "                                                                                                        [2 1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1101       "                                                                                          [2 1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1102       "                                                                                  [2 1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1103       "                                      [2 1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1104       "                            [2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[2 1 0]] [[] =] . infra first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1105       "                                                                                                                       [2 1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 1 0]] swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1106       "                                                                                                                    [2 1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 1 0]] swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1107       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 1 0]] swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1108       "                                     False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [2 1 0]] . swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1109       "                                     [2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1110       "                                       [2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1111       "                                                     [2 1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1112       "                                                                                                                       [2 1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1113       "                                                                                                                       2 [1 0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1114       "                                                                                                                       [1 0] 2 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1115       "                                                                         [1 0] 2 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1116       "                                                                                                                         [1 0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1117       "                                                                                                                  [1 0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1118       "                                                                                                          [1 0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1119       "                                                                                            [1 0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1120       "                                                                                    [1 0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1121       "                                        [1 0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1122       "                                [1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[1 0]] [[] =] . infra first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1123       "                                                                                                                         [1 0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [1 0]] swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1124       "                                                                                                                      [1 0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [1 0]] swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1125       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [1 0]] swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1126       "                                       False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [1 0]] . swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1127       "                                       [1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1128       "                                         [1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1129       "                                                       [1 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1130       "                                                                                                                         [1 0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1131       "                                                                                                                         1 [0] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1132       "                                                                                                                         [0] 1 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1133       "                                                                           [0] 1 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1134       "                                                                                                                           [0] . [[] =] [pop 0] [uncons swap] [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1135       "                                                                                                                    [0] [[] =] . [pop 0] [uncons swap] [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1136       "                                                                                                            [0] [[] =] [pop 0] . [uncons swap] [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1137       "                                                                                              [0] [[] =] [pop 0] [uncons swap] . [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1138       "                                                                                      [0] [[] =] [pop 0] [uncons swap] [dip +] . genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1139       "                                          [0] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1140       "                                    [0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[0]] [[] =] . infra first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1141       "                                                                                                                           [0] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [0]] swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1142       "                                                                                                                        [0] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [0]] swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1143       "                                                                                                                         False . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [0]] swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1144       "                                         False [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [0]] . swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1145       "                                         [0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [False] . first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1146       "                                           [0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] False . choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1147       "                                                         [0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1148       "                                                                                                                           [0] . uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1149       "                                                                                                                          0 [] . swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1150       "                                                                                                                          [] 0 . [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1151       "                                                                            [] 0 [[[] =] [pop 0] [uncons swap] [dip +] genrec] . dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1152       "                                                                                                                            [] . [[] =] [pop 0] [uncons swap] [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1153       "                                                                                                                     [] [[] =] . [pop 0] [uncons swap] [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1154       "                                                                                                             [] [[] =] [pop 0] . [uncons swap] [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1155       "                                                                                               [] [[] =] [pop 0] [uncons swap] . [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1156       "                                                                                       [] [[] =] [pop 0] [uncons swap] [dip +] . genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1157       "                                           [] [[] =] [pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] . ifte 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1158       "                                      [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [[]] [[] =] . infra first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1159       "                                                                                                                            [] . [] = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] []] swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1160       "                                                                                                                         [] [] . = [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] []] swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1161       "                                                                                                                          True . [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] []] swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1162       "                                           True [[pop 0] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] []] . swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1163       "                                           [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] [True] . first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1164       "                                             [] [uncons swap [[[] =] [pop 0] [uncons swap] [dip +] genrec] dip +] [pop 0] True . choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1165       "                                                                                                                    [] [pop 0] . i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1166       "                                                                                                                            [] . pop 0 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1167       "                                                                                                                               . 0 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1168       "                                                                                                                             0 . 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1169       "                                                                                                                           0 0 . + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1170       "                                                                                                                             0 . 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1171       "                                                                                                                           0 1 . + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1172       "                                                                                                                             1 . 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1173       "                                                                                                                           1 2 . + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1174       "                                                                                                                             3 . 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1175       "                                                                                                                           3 3 . + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1176       "                                                                                                                             6 . 4 + 5 + 6 + 7 + 8 + 9 +\n",
1177       "                                                                                                                           6 4 . + 5 + 6 + 7 + 8 + 9 +\n",
1178       "                                                                                                                            10 . 5 + 6 + 7 + 8 + 9 +\n",
1179       "                                                                                                                          10 5 . + 6 + 7 + 8 + 9 +\n",
1180       "                                                                                                                            15 . 6 + 7 + 8 + 9 +\n",
1181       "                                                                                                                          15 6 . + 7 + 8 + 9 +\n",
1182       "                                                                                                                            21 . 7 + 8 + 9 +\n",
1183       "                                                                                                                          21 7 . + 8 + 9 +\n",
1184       "                                                                                                                            28 . 8 + 9 +\n",
1185       "                                                                                                                          28 8 . + 9 +\n",
1186       "                                                                                                                            36 . 9 +\n",
1187       "                                                                                                                          36 9 . +\n",
1188       "                                                                                                                            45 . \n"
1189      ]
1190     }
1191    ],
1192    "source": [
1193     "V('10 range sum')"
1194    ]
1195   },
1196   {
1197    "cell_type": "code",
1198    "execution_count": 14,
1199    "metadata": {},
1200    "outputs": [
1201     {
1202      "name": "stdout",
1203      "output_type": "stream",
1204      "text": [
1205       "                                                                                 . 10 range_sum\n",
1206       "                                                                              10 . range_sum\n",
1207       "                                                                              10 . [0 <=] 0 [1 - dup] [+] hylomorphism\n",
1208       "                                                                       10 [0 <=] . 0 [1 - dup] [+] hylomorphism\n",
1209       "                                                                     10 [0 <=] 0 . [1 - dup] [+] hylomorphism\n",
1210       "                                                           10 [0 <=] 0 [1 - dup] . [+] hylomorphism\n",
1211       "                                                       10 [0 <=] 0 [1 - dup] [+] . hylomorphism\n",
1212       "                                                       10 [0 <=] 0 [1 - dup] [+] . [unit [pop] swoncat] dipd [dip] swoncat genrec\n",
1213       "                                  10 [0 <=] 0 [1 - dup] [+] [unit [pop] swoncat] . dipd [dip] swoncat genrec\n",
1214       "                                                                     10 [0 <=] 0 . unit [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
1215       "                                                                     10 [0 <=] 0 . [] cons [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
1216       "                                                                  10 [0 <=] 0 [] . cons [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
1217       "                                                                   10 [0 <=] [0] . [pop] swoncat [1 - dup] [+] [dip] swoncat genrec\n",
1218       "                                                             10 [0 <=] [0] [pop] . swoncat [1 - dup] [+] [dip] swoncat genrec\n",
1219       "                                                             10 [0 <=] [0] [pop] . swap concat [1 - dup] [+] [dip] swoncat genrec\n",
1220       "                                                             10 [0 <=] [pop] [0] . concat [1 - dup] [+] [dip] swoncat genrec\n",
1221       "                                                               10 [0 <=] [pop 0] . [1 - dup] [+] [dip] swoncat genrec\n",
1222       "                                                     10 [0 <=] [pop 0] [1 - dup] . [+] [dip] swoncat genrec\n",
1223       "                                                 10 [0 <=] [pop 0] [1 - dup] [+] . [dip] swoncat genrec\n",
1224       "                                           10 [0 <=] [pop 0] [1 - dup] [+] [dip] . swoncat genrec\n",
1225       "                                           10 [0 <=] [pop 0] [1 - dup] [+] [dip] . swap concat genrec\n",
1226       "                                           10 [0 <=] [pop 0] [1 - dup] [dip] [+] . concat genrec\n",
1227       "                                             10 [0 <=] [pop 0] [1 - dup] [dip +] . genrec\n",
1228       "     10 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte\n",
1229       "10 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [10] [0 <=] . infra first choice i\n",
1230       "                                                                              10 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 10] swaack first choice i\n",
1231       "                                                                            10 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 10] swaack first choice i\n",
1232       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 10] swaack first choice i\n",
1233       "    False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 10] . swaack first choice i\n",
1234       "    10 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i\n",
1235       "      10 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i\n",
1236       "                    10 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i\n",
1237       "                                                                              10 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
1238       "                                                                            10 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
1239       "                                                                               9 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
1240       "                                                                             9 9 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +\n",
1241       "                                   9 9 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip +\n",
1242       "                                                                               9 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 9 +\n",
1243       "                                                                        9 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 9 +\n",
1244       "                                                                9 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 9 +\n",
1245       "                                                      9 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 9 +\n",
1246       "                                              9 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 9 +\n",
1247       "      9 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 9 +\n",
1248       "  9 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [9] [0 <=] . infra first choice i 9 +\n",
1249       "                                                                               9 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 9] swaack first choice i 9 +\n",
1250       "                                                                             9 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 9] swaack first choice i 9 +\n",
1251       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 9] swaack first choice i 9 +\n",
1252       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 9] . swaack first choice i 9 +\n",
1253       "     9 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 9 +\n",
1254       "       9 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 9 +\n",
1255       "                     9 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 9 +\n",
1256       "                                                                               9 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 9 +\n",
1257       "                                                                             9 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 9 +\n",
1258       "                                                                               8 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 9 +\n",
1259       "                                                                             8 8 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 9 +\n",
1260       "                                   8 8 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 9 +\n",
1261       "                                                                               8 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 8 + 9 +\n",
1262       "                                                                        8 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 8 + 9 +\n",
1263       "                                                                8 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 8 + 9 +\n",
1264       "                                                      8 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 8 + 9 +\n",
1265       "                                              8 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 8 + 9 +\n",
1266       "      8 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 8 + 9 +\n",
1267       "  8 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [8] [0 <=] . infra first choice i 8 + 9 +\n",
1268       "                                                                               8 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 8] swaack first choice i 8 + 9 +\n",
1269       "                                                                             8 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 8] swaack first choice i 8 + 9 +\n",
1270       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 8] swaack first choice i 8 + 9 +\n",
1271       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 8] . swaack first choice i 8 + 9 +\n",
1272       "     8 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 8 + 9 +\n",
1273       "       8 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 8 + 9 +\n",
1274       "                     8 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 8 + 9 +\n",
1275       "                                                                               8 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 8 + 9 +\n",
1276       "                                                                             8 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 8 + 9 +\n",
1277       "                                                                               7 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 8 + 9 +\n",
1278       "                                                                             7 7 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 8 + 9 +\n",
1279       "                                   7 7 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 8 + 9 +\n",
1280       "                                                                               7 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 7 + 8 + 9 +\n",
1281       "                                                                        7 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 7 + 8 + 9 +\n",
1282       "                                                                7 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 7 + 8 + 9 +\n",
1283       "                                                      7 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 7 + 8 + 9 +\n",
1284       "                                              7 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 7 + 8 + 9 +\n",
1285       "      7 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 7 + 8 + 9 +\n",
1286       "  7 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [7] [0 <=] . infra first choice i 7 + 8 + 9 +\n",
1287       "                                                                               7 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 7] swaack first choice i 7 + 8 + 9 +\n",
1288       "                                                                             7 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 7] swaack first choice i 7 + 8 + 9 +\n",
1289       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 7] swaack first choice i 7 + 8 + 9 +\n",
1290       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 7] . swaack first choice i 7 + 8 + 9 +\n",
1291       "     7 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 7 + 8 + 9 +\n",
1292       "       7 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 7 + 8 + 9 +\n",
1293       "                     7 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 7 + 8 + 9 +\n",
1294       "                                                                               7 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1295       "                                                                             7 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1296       "                                                                               6 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1297       "                                                                             6 6 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 7 + 8 + 9 +\n",
1298       "                                   6 6 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 7 + 8 + 9 +\n",
1299       "                                                                               6 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 6 + 7 + 8 + 9 +\n",
1300       "                                                                        6 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 6 + 7 + 8 + 9 +\n",
1301       "                                                                6 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 6 + 7 + 8 + 9 +\n",
1302       "                                                      6 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 6 + 7 + 8 + 9 +\n",
1303       "                                              6 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 6 + 7 + 8 + 9 +\n",
1304       "      6 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 6 + 7 + 8 + 9 +\n",
1305       "  6 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [6] [0 <=] . infra first choice i 6 + 7 + 8 + 9 +\n",
1306       "                                                                               6 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 6] swaack first choice i 6 + 7 + 8 + 9 +\n",
1307       "                                                                             6 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 6] swaack first choice i 6 + 7 + 8 + 9 +\n",
1308       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 6] swaack first choice i 6 + 7 + 8 + 9 +\n",
1309       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 6] . swaack first choice i 6 + 7 + 8 + 9 +\n",
1310       "     6 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 6 + 7 + 8 + 9 +\n",
1311       "       6 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 6 + 7 + 8 + 9 +\n",
1312       "                     6 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 6 + 7 + 8 + 9 +\n",
1313       "                                                                               6 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1314       "                                                                             6 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1315       "                                                                               5 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1316       "                                                                             5 5 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 6 + 7 + 8 + 9 +\n",
1317       "                                   5 5 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 6 + 7 + 8 + 9 +\n",
1318       "                                                                               5 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1319       "                                                                        5 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1320       "                                                                5 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1321       "                                                      5 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 5 + 6 + 7 + 8 + 9 +\n",
1322       "                                              5 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 5 + 6 + 7 + 8 + 9 +\n",
1323       "      5 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 5 + 6 + 7 + 8 + 9 +\n",
1324       "  5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [5] [0 <=] . infra first choice i 5 + 6 + 7 + 8 + 9 +\n",
1325       "                                                                               5 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1326       "                                                                             5 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1327       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1328       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 5] . swaack first choice i 5 + 6 + 7 + 8 + 9 +\n",
1329       "     5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 5 + 6 + 7 + 8 + 9 +\n",
1330       "       5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 5 + 6 + 7 + 8 + 9 +\n",
1331       "                     5 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 5 + 6 + 7 + 8 + 9 +\n",
1332       "                                                                               5 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1333       "                                                                             5 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1334       "                                                                               4 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1335       "                                                                             4 4 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 5 + 6 + 7 + 8 + 9 +\n",
1336       "                                   4 4 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 5 + 6 + 7 + 8 + 9 +\n",
1337       "                                                                               4 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1338       "                                                                        4 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1339       "                                                                4 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1340       "                                                      4 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1341       "                                              4 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 4 + 5 + 6 + 7 + 8 + 9 +\n",
1342       "      4 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 4 + 5 + 6 + 7 + 8 + 9 +\n",
1343       "  4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [4] [0 <=] . infra first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1344       "                                                                               4 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1345       "                                                                             4 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1346       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1347       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 4] . swaack first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1348       "     4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1349       "       4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1350       "                     4 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 4 + 5 + 6 + 7 + 8 + 9 +\n",
1351       "                                                                               4 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1352       "                                                                             4 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1353       "                                                                               3 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1354       "                                                                             3 3 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1355       "                                   3 3 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1356       "                                                                               3 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1357       "                                                                        3 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1358       "                                                                3 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1359       "                                                      3 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1360       "                                              3 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1361       "      3 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1362       "  3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [3] [0 <=] . infra first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1363       "                                                                               3 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1364       "                                                                             3 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1365       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1366       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 3] . swaack first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1367       "     3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1368       "       3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1369       "                     3 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1370       "                                                                               3 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1371       "                                                                             3 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1372       "                                                                               2 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1373       "                                                                             2 2 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1374       "                                   2 2 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1375       "                                                                               2 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1376       "                                                                        2 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1377       "                                                                2 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1378       "                                                      2 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1379       "                                              2 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1380       "      2 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1381       "  2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [2] [0 <=] . infra first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1382       "                                                                               2 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1383       "                                                                             2 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1384       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1385       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 2] . swaack first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1386       "     2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1387       "       2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1388       "                     2 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1389       "                                                                               2 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1390       "                                                                             2 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1391       "                                                                               1 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1392       "                                                                             1 1 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1393       "                                   1 1 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1394       "                                                                               1 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1395       "                                                                        1 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1396       "                                                                1 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1397       "                                                      1 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1398       "                                              1 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1399       "      1 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1400       "  1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [1] [0 <=] . infra first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1401       "                                                                               1 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1402       "                                                                             1 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1403       "                                                                           False . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1404       "     False [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 1] . swaack first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1405       "     1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [False] . first choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1406       "       1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] False . choice i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1407       "                     1 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . i 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1408       "                                                                               1 . 1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1409       "                                                                             1 1 . - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1410       "                                                                               0 . dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1411       "                                                                             0 0 . [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1412       "                                   0 0 [[0 <=] [pop 0] [1 - dup] [dip +] genrec] . dip + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1413       "                                                                               0 . [0 <=] [pop 0] [1 - dup] [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1414       "                                                                        0 [0 <=] . [pop 0] [1 - dup] [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1415       "                                                                0 [0 <=] [pop 0] . [1 - dup] [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1416       "                                                      0 [0 <=] [pop 0] [1 - dup] . [dip +] genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1417       "                                              0 [0 <=] [pop 0] [1 - dup] [dip +] . genrec 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1418       "      0 [0 <=] [pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] . ifte 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1419       "  0 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [0] [0 <=] . infra first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1420       "                                                                               0 . 0 <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1421       "                                                                             0 0 . <= [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1422       "                                                                            True . [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1423       "      True [[pop 0] [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] 0] . swaack first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1424       "      0 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] [True] . first choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1425       "        0 [1 - dup [[0 <=] [pop 0] [1 - dup] [dip +] genrec] dip +] [pop 0] True . choice i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1426       "                                                                       0 [pop 0] . i 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1427       "                                                                               0 . pop 0 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1428       "                                                                                 . 0 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1429       "                                                                               0 . 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1430       "                                                                             0 0 . + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1431       "                                                                               0 . 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1432       "                                                                             0 1 . + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1433       "                                                                               1 . 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1434       "                                                                             1 2 . + 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1435       "                                                                               3 . 3 + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1436       "                                                                             3 3 . + 4 + 5 + 6 + 7 + 8 + 9 +\n",
1437       "                                                                               6 . 4 + 5 + 6 + 7 + 8 + 9 +\n",
1438       "                                                                             6 4 . + 5 + 6 + 7 + 8 + 9 +\n",
1439       "                                                                              10 . 5 + 6 + 7 + 8 + 9 +\n",
1440       "                                                                            10 5 . + 6 + 7 + 8 + 9 +\n",
1441       "                                                                              15 . 6 + 7 + 8 + 9 +\n",
1442       "                                                                            15 6 . + 7 + 8 + 9 +\n",
1443       "                                                                              21 . 7 + 8 + 9 +\n",
1444       "                                                                            21 7 . + 8 + 9 +\n",
1445       "                                                                              28 . 8 + 9 +\n",
1446       "                                                                            28 8 . + 9 +\n",
1447       "                                                                              36 . 9 +\n",
1448       "                                                                            36 9 . +\n",
1449       "                                                                              45 . \n"
1450      ]
1451     }
1452    ],
1453    "source": [
1454     "V('10 range_sum')"
1455    ]
1456   },
1457   {
1458    "cell_type": "markdown",
1459    "metadata": {},
1460    "source": [
1461     "# Factorial Function and Paramorphisms\n",
1462     "A paramorphism `P :: B -> A` is a recursion combinator that uses `dup` on intermediate values.\n",
1463     "\n",
1464     "    n swap [P] [pop] [[F] dupdip G] primrec\n",
1465     "\n",
1466     "With\n",
1467     "- `n :: A` is the \"identity\" for `F` (like 1 for multiplication, 0 for addition)\n",
1468     "- `F :: (A, B) -> A`\n",
1469     "- `G :: B -> B` generates the next `B` value.\n",
1470     "- and lastly `P :: B -> Bool` detects the end of the series."
1471    ]
1472   },
1473   {
1474    "cell_type": "markdown",
1475    "metadata": {},
1476    "source": [
1477     "For Factorial function (types `A` and `B` are both integer):\n",
1478     "\n",
1479     "    n == 1\n",
1480     "    F == *\n",
1481     "    G == --\n",
1482     "    P == 1 <="
1483    ]
1484   },
1485   {
1486    "cell_type": "code",
1487    "execution_count": 15,
1488    "metadata": {},
1489    "outputs": [],
1490    "source": [
1491     "define('factorial == 1 swap [1 <=] [pop] [[*] dupdip --] primrec')"
1492    ]
1493   },
1494   {
1495    "cell_type": "markdown",
1496    "metadata": {},
1497    "source": [
1498     "Try it with input 3 (omitting evaluation of predicate):\n",
1499     "\n",
1500     "    3 1 swap [1 <=] [pop] [[*] dupdip --] primrec\n",
1501     "    1 3      [1 <=] [pop] [[*] dupdip --] primrec\n",
1502     "\n",
1503     "    1 3 [*] dupdip --\n",
1504     "    1 3  * 3      --\n",
1505     "    3      3      --\n",
1506     "    3      2\n",
1507     "\n",
1508     "    3 2 [*] dupdip --\n",
1509     "    3 2  *  2      --\n",
1510     "    6       2      --\n",
1511     "    6       1\n",
1512     "\n",
1513     "    6 1 [1 <=] [pop] [[*] dupdip --] primrec\n",
1514     "\n",
1515     "    6 1 pop\n",
1516     "    6"
1517    ]
1518   },
1519   {
1520    "cell_type": "code",
1521    "execution_count": 16,
1522    "metadata": {},
1523    "outputs": [
1524     {
1525      "name": "stdout",
1526      "output_type": "stream",
1527      "text": [
1528       "6\n"
1529      ]
1530     }
1531    ],
1532    "source": [
1533     "J('3 factorial')"
1534    ]
1535   },
1536   {
1537    "cell_type": "markdown",
1538    "metadata": {},
1539    "source": [
1540     "### Derive `paramorphism` from the form above.\n",
1541     "\n",
1542     "    n swap [P] [pop] [[F] dupdip G] primrec\n",
1543     "\n",
1544     "    n swap [P]       [pop]     [[F] dupdip G]                  primrec\n",
1545     "    n [P] [swap] dip [pop]     [[F] dupdip G]                  primrec\n",
1546     "    n [P] [[F] dupdip G]                [[swap] dip [pop]] dip primrec\n",
1547     "    n [P] [F] [dupdip G]           cons [[swap] dip [pop]] dip primrec\n",
1548     "    n [P] [F] [G] [dupdip] swoncat cons [[swap] dip [pop]] dip primrec\n",
1549     "\n",
1550     "    paramorphism == [dupdip] swoncat cons [[swap] dip [pop]] dip primrec"
1551    ]
1552   },
1553   {
1554    "cell_type": "code",
1555    "execution_count": 17,
1556    "metadata": {},
1557    "outputs": [],
1558    "source": [
1559     "define('paramorphism == [dupdip] swoncat cons [[swap] dip [pop]] dip primrec')\n",
1560     "define('factorial == 1 [1 <=] [*] [--] paramorphism')"
1561    ]
1562   },
1563   {
1564    "cell_type": "code",
1565    "execution_count": 18,
1566    "metadata": {},
1567    "outputs": [
1568     {
1569      "name": "stdout",
1570      "output_type": "stream",
1571      "text": [
1572       "6\n"
1573      ]
1574     }
1575    ],
1576    "source": [
1577     "J('3 factorial')"
1578    ]
1579   },
1580   {
1581    "cell_type": "markdown",
1582    "metadata": {},
1583    "source": [
1584     "# `tails`\n",
1585     "An example of a paramorphism for lists given in the [\"Bananas...\" paper](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.125) is `tails` which returns the list of \"tails\" of a list.\n",
1586     "\n",
1587     "    [1 2 3] tails == [[] [3] [2 3]]\n",
1588     "    \n",
1589     "Using `paramorphism` we would write:\n",
1590     "\n",
1591     "    n == []\n",
1592     "    F == rest swons\n",
1593     "    G == rest\n",
1594     "    P == not\n",
1595     "\n",
1596     "    tails == [] [not] [rest swons] [rest] paramorphism"
1597    ]
1598   },
1599   {
1600    "cell_type": "code",
1601    "execution_count": 19,
1602    "metadata": {},
1603    "outputs": [],
1604    "source": [
1605     "define('tails == [] [not] [rest swons] [rest] paramorphism')"
1606    ]
1607   },
1608   {
1609    "cell_type": "code",
1610    "execution_count": 20,
1611    "metadata": {},
1612    "outputs": [
1613     {
1614      "name": "stdout",
1615      "output_type": "stream",
1616      "text": [
1617       "[[] [3] [2 3]]\n"
1618      ]
1619     }
1620    ],
1621    "source": [
1622     "J('[1 2 3] tails')"
1623    ]
1624   },
1625   {
1626    "cell_type": "code",
1627    "execution_count": 21,
1628    "metadata": {},
1629    "outputs": [
1630     {
1631      "name": "stdout",
1632      "output_type": "stream",
1633      "text": [
1634       "[1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276]\n"
1635      ]
1636     }
1637    ],
1638    "source": [
1639     "J('25 range tails [popop] infra [sum] map')"
1640    ]
1641   },
1642   {
1643    "cell_type": "code",
1644    "execution_count": 22,
1645    "metadata": {},
1646    "outputs": [
1647     {
1648      "name": "stdout",
1649      "output_type": "stream",
1650      "text": [
1651       "[276 253 231 210 190 171 153 136 120 105 91 78 66 55 45 36 28 21 15 10 6 3 1 0 0]\n"
1652      ]
1653     }
1654    ],
1655    "source": [
1656     "J('25 range [range_sum] map')"
1657    ]
1658   },
1659   {
1660    "cell_type": "markdown",
1661    "metadata": {},
1662    "source": [
1663     "### Factoring `rest`\n",
1664     "Right before the recursion begins we have:\n",
1665     "    \n",
1666     "    [] [1 2 3] [not] [pop] [[rest swons] dupdip rest] primrec\n",
1667     "    \n",
1668     "But we might prefer to factor `rest` in the quote:\n",
1669     "\n",
1670     "    [] [1 2 3] [not] [pop] [rest [swons] dupdip] primrec\n",
1671     "\n",
1672     "There's no way to do that with the `paramorphism` combinator as defined.  We would have to write and use a slightly different recursion combinator that accepted an additional \"preprocessor\" function `[H]` and built:\n",
1673     "\n",
1674     "    n swap [P] [pop] [H [F] dupdip G] primrec\n",
1675     "\n",
1676     "Or just write it out manually.  This is yet another place where the *sufficiently smart compiler* will one day automatically refactor the code.  We could write a `paramorphism` combinator that checked `[F]` and `[G]` for common prefix and extracted it."
1677    ]
1678   },
1679   {
1680    "cell_type": "markdown",
1681    "metadata": {},
1682    "source": [
1683     "# Patterns of Recursion\n",
1684     "Our story so far...\n",
1685     "\n",
1686     "- A combiner `F :: (B, B) -> B`\n",
1687     "- A predicate `P :: A -> Bool` to detect the base case\n",
1688     "- A base case value `c :: B`\n",
1689     "\n",
1690     "\n",
1691     "### Hylo-, Ana-, Cata-\n",
1692     "\n",
1693     "    w/ G :: A -> (A, B)\n",
1694     "\n",
1695     "    H == [P   ] [pop c ] [G          ] [dip F    ] genrec\n",
1696     "    A == [P   ] [pop []] [G          ] [dip swons] genrec\n",
1697     "    C == [[] =] [pop c ] [uncons swap] [dip F    ] genrec\n",
1698     "\n",
1699     "### Para-, ?-, ?-\n",
1700     "\n",
1701     "    w/ G :: B -> B\n",
1702     "\n",
1703     "    P == c  swap [P   ] [pop] [[F    ] dupdip G          ] primrec\n",
1704     "    ? == [] swap [P   ] [pop] [[swons] dupdip G          ] primrec\n",
1705     "    ? == c  swap [[] =] [pop] [[F    ] dupdip uncons swap] primrec\n"
1706    ]
1707   },
1708   {
1709    "cell_type": "markdown",
1710    "metadata": {},
1711    "source": [
1712     "# Four Generalizations\n",
1713     "There are at least four kinds of recursive combinator, depending on two choices.  The first choice is whether the combiner function should be evaluated during the recursion or pushed into the pending expression to be \"collapsed\" at the end.  The second choice is whether the combiner needs to operate on the current value of the datastructure or the generator's output.\n",
1714     "\n",
1715     "    H ==        [P] [pop c] [G             ] [dip F] genrec\n",
1716     "    H == c swap [P] [pop]   [G [F]    dip  ] [i]     genrec\n",
1717     "    H ==        [P] [pop c] [  [G] dupdip  ] [dip F] genrec\n",
1718     "    H == c swap [P] [pop]   [  [F] dupdip G] [i]     genrec\n",
1719     "\n",
1720     "Consider:\n",
1721     "\n",
1722     "    ... a G [H] dip F                w/ a G == a' b\n",
1723     "    ... c a G [F] dip H                 a G == b  a'\n",
1724     "    ... a [G] dupdip [H] dip F          a G == a'\n",
1725     "    ... c a [F] dupdip G H              a G == a'"
1726    ]
1727   },
1728   {
1729    "cell_type": "markdown",
1730    "metadata": {},
1731    "source": [
1732     "### 1\n",
1733     "\n",
1734     "    H == [P] [pop c] [G] [dip F] genrec\n",
1735     "\n",
1736     "Iterate n times.\n",
1737     "\n",
1738     "    ... a [P] [pop c] [G] [dip F] genrec\n",
1739     "    ... a  G [H] dip F\n",
1740     "    ... a' b [H] dip F\n",
1741     "    ... a' H b F\n",
1742     "    ... a'  G [H] dip F b F\n",
1743     "    ... a'' b [H] dip F b F\n",
1744     "    ... a'' H b F b F\n",
1745     "    ... a''  G [H] dip F b F b F\n",
1746     "    ... a''' b [H] dip F b F b F\n",
1747     "    ... a''' H b F b F b F\n",
1748     "    ... a''' pop c b F b F b F\n",
1749     "    ... c b F b F b F\n",
1750     "\n",
1751     "This form builds up a continuation that contains the intermediate results along with the pending combiner functions.  When the base case is reached the last term is replaced by the identity value c and the continuation \"collapses\" into the final result."
1752    ]
1753   },
1754   {
1755    "cell_type": "markdown",
1756    "metadata": {},
1757    "source": [
1758     "### 2\n",
1759     "When you can start with the identity value c on the stack and the combiner can operate as you go, using the intermediate results immediately rather than queuing them up, use this form.  An important difference is that the generator function must return its results in the reverse order.\n",
1760     "\n",
1761     "    H == c swap [P] [pop] [G [F] dip] primrec\n",
1762     "\n",
1763     "    ... c a G [F] dip H\n",
1764     "    ... c b a' [F] dip H\n",
1765     "    ... c b F a' H\n",
1766     "    ... c b F a' G [F] dip H\n",
1767     "    ... c b F b a'' [F] dip H\n",
1768     "    ... c b F b F a'' H\n",
1769     "    ... c b F b F a'' G [F] dip H\n",
1770     "    ... c b F b F b a''' [F] dip H\n",
1771     "    ... c b F b F b F a''' H\n",
1772     "    ... c b F b F b F a''' pop\n",
1773     "    ... c b F b F b F\n",
1774     "\n",
1775     "The end line here is the same as for above, but only because we didn't evaluate `F` when it normally would have been."
1776    ]
1777   },
1778   {
1779    "cell_type": "markdown",
1780    "metadata": {},
1781    "source": [
1782     "### 3\n",
1783     "If the combiner and the generator both need to work on the current value then `dup` must be used at some point, and the generator must produce one item instead of two (the b is instead the duplicate of a.)\n",
1784     "\n",
1785     "\n",
1786     "    H == [P] [pop c] [[G] dupdip] [dip F] genrec\n",
1787     "\n",
1788     "    ... a [G] dupdip [H] dip F\n",
1789     "    ... a  G a       [H] dip F\n",
1790     "    ... a'   a       [H] dip F\n",
1791     "    ... a' H a F\n",
1792     "    ... a' [G] dupdip [H] dip F a F\n",
1793     "    ... a'  G  a'     [H] dip F a F\n",
1794     "    ... a''    a'     [H] dip F a F\n",
1795     "    ... a'' H  a' F a F\n",
1796     "    ... a'' [G] dupdip [H] dip F a' F a F\n",
1797     "    ... a''  G  a''    [H] dip F a' F a F\n",
1798     "    ... a'''    a''    [H] dip F a' F a F\n",
1799     "    ... a''' H  a'' F a' F a F\n",
1800     "    ... a''' pop c  a'' F a' F a F\n",
1801     "    ...          c  a'' F a' F a F"
1802    ]
1803   },
1804   {
1805    "cell_type": "markdown",
1806    "metadata": {},
1807    "source": [
1808     "### 4\n",
1809     "And, last but not least, if you can combine as you go, starting with c, and the combiner needs to work on the current item, this is the form:\n",
1810     "\n",
1811     "    W == c swap [P] [pop] [[F] dupdip G] primrec\n",
1812     "\n",
1813     "    ... a c swap [P] [pop] [[F] dupdip G] primrec\n",
1814     "    ... c a [P] [pop] [[F] dupdip G] primrec\n",
1815     "    ... c a [F] dupdip G W\n",
1816     "    ... c a  F a G W\n",
1817     "    ... c a  F a'  W\n",
1818     "    ... c a  F a'  [F] dupdip G W\n",
1819     "    ... c a  F a'   F  a'     G W\n",
1820     "    ... c a  F a'   F  a''      W\n",
1821     "    ... c a  F a'   F  a''      [F] dupdip G W\n",
1822     "    ... c a  F a'   F  a''       F  a''    G W\n",
1823     "    ... c a  F a'   F  a''       F  a'''     W\n",
1824     "    ... c a  F a'   F  a''       F  a'''     pop\n",
1825     "    ... c a  F a'   F  a''       F"
1826    ]
1827   },
1828   {
1829    "cell_type": "markdown",
1830    "metadata": {},
1831    "source": [
1832     "Each of the four variations above can be specialized to ana- and catamorphic forms."
1833    ]
1834   },
1835   {
1836    "cell_type": "code",
1837    "execution_count": 23,
1838    "metadata": {},
1839    "outputs": [],
1840    "source": [
1841     "def WTFmorphism(c, F, P, G):\n",
1842     "    '''Return a hylomorphism function H.'''\n",
1843     "\n",
1844     "    def H(a, d=c):\n",
1845     "        if P(a):\n",
1846     "            result = d\n",
1847     "        else:\n",
1848     "            a, b = G(a)\n",
1849     "            result = H(a, F(d, b))\n",
1850     "        return result\n",
1851     "\n",
1852     "    return H"
1853    ]
1854   },
1855   {
1856    "cell_type": "code",
1857    "execution_count": 24,
1858    "metadata": {},
1859    "outputs": [
1860     {
1861      "name": "stdout",
1862      "output_type": "stream",
1863      "text": [
1864       "10\n"
1865      ]
1866     }
1867    ],
1868    "source": [
1869     "F = lambda a, b: a + b\n",
1870     "P = lambda n: n <= 1\n",
1871     "G = lambda n: (n - 1, n - 1)\n",
1872     "\n",
1873     "wtf = WTFmorphism(0, F, P, G)\n",
1874     "\n",
1875     "print wtf(5)"
1876    ]
1877   },
1878   {
1879    "cell_type": "markdown",
1880    "metadata": {},
1881    "source": [
1882     "    H == [P   ] [pop c ] [G          ] [dip F    ] genrec"
1883    ]
1884   },
1885   {
1886    "cell_type": "code",
1887    "execution_count": 25,
1888    "metadata": {},
1889    "outputs": [],
1890    "source": [
1891     "DefinitionWrapper.add_definitions('''\n",
1892     "P == 1 <=\n",
1893     "Ga == -- dup\n",
1894     "Gb == --\n",
1895     "c == 0\n",
1896     "F == +\n",
1897     "''', D)"
1898    ]
1899   },
1900   {
1901    "cell_type": "code",
1902    "execution_count": 26,
1903    "metadata": {},
1904    "outputs": [
1905     {
1906      "name": "stdout",
1907      "output_type": "stream",
1908      "text": [
1909       "                                                                                                             . [1 2 3] [[] =] [pop []] [uncons swap] [dip swons] genrec\n",
1910       "                                                                                                     [1 2 3] . [[] =] [pop []] [uncons swap] [dip swons] genrec\n",
1911       "                                                                                              [1 2 3] [[] =] . [pop []] [uncons swap] [dip swons] genrec\n",
1912       "                                                                                     [1 2 3] [[] =] [pop []] . [uncons swap] [dip swons] genrec\n",
1913       "                                                                       [1 2 3] [[] =] [pop []] [uncons swap] . [dip swons] genrec\n",
1914       "                                                           [1 2 3] [[] =] [pop []] [uncons swap] [dip swons] . genrec\n",
1915       "          [1 2 3] [[] =] [pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . ifte\n",
1916       "[1 2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [[1 2 3]] [[] =] . infra first choice i\n",
1917       "                                                                                                     [1 2 3] . [] = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [1 2 3]] swaack first choice i\n",
1918       "                                                                                                  [1 2 3] [] . = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [1 2 3]] swaack first choice i\n",
1919       "                                                                                                       False . [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [1 2 3]] swaack first choice i\n",
1920       "         False [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [1 2 3]] . swaack first choice i\n",
1921       "         [1 2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [False] . first choice i\n",
1922       "           [1 2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] False . choice i\n",
1923       "                          [1 2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . i\n",
1924       "                                                                                                     [1 2 3] . uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons\n",
1925       "                                                                                                     1 [2 3] . swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons\n",
1926       "                                                                                                     [2 3] 1 . [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons\n",
1927       "                                                  [2 3] 1 [[[] =] [pop []] [uncons swap] [dip swons] genrec] . dip swons\n",
1928       "                                                                                                       [2 3] . [[] =] [pop []] [uncons swap] [dip swons] genrec 1 swons\n",
1929       "                                                                                                [2 3] [[] =] . [pop []] [uncons swap] [dip swons] genrec 1 swons\n",
1930       "                                                                                       [2 3] [[] =] [pop []] . [uncons swap] [dip swons] genrec 1 swons\n",
1931       "                                                                         [2 3] [[] =] [pop []] [uncons swap] . [dip swons] genrec 1 swons\n",
1932       "                                                             [2 3] [[] =] [pop []] [uncons swap] [dip swons] . genrec 1 swons\n",
1933       "            [2 3] [[] =] [pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . ifte 1 swons\n",
1934       "    [2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [[2 3]] [[] =] . infra first choice i 1 swons\n",
1935       "                                                                                                       [2 3] . [] = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [2 3]] swaack first choice i 1 swons\n",
1936       "                                                                                                    [2 3] [] . = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [2 3]] swaack first choice i 1 swons\n",
1937       "                                                                                                       False . [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [2 3]] swaack first choice i 1 swons\n",
1938       "           False [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [2 3]] . swaack first choice i 1 swons\n",
1939       "           [2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 1 swons\n",
1940       "             [2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] False . choice i 1 swons\n",
1941       "                            [2 3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . i 1 swons\n",
1942       "                                                                                                       [2 3] . uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons 1 swons\n",
1943       "                                                                                                       2 [3] . swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons 1 swons\n",
1944       "                                                                                                       [3] 2 . [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons 1 swons\n",
1945       "                                                    [3] 2 [[[] =] [pop []] [uncons swap] [dip swons] genrec] . dip swons 1 swons\n",
1946       "                                                                                                         [3] . [[] =] [pop []] [uncons swap] [dip swons] genrec 2 swons 1 swons\n",
1947       "                                                                                                  [3] [[] =] . [pop []] [uncons swap] [dip swons] genrec 2 swons 1 swons\n",
1948       "                                                                                         [3] [[] =] [pop []] . [uncons swap] [dip swons] genrec 2 swons 1 swons\n",
1949       "                                                                           [3] [[] =] [pop []] [uncons swap] . [dip swons] genrec 2 swons 1 swons\n",
1950       "                                                               [3] [[] =] [pop []] [uncons swap] [dip swons] . genrec 2 swons 1 swons\n",
1951       "              [3] [[] =] [pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . ifte 2 swons 1 swons\n",
1952       "        [3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [[3]] [[] =] . infra first choice i 2 swons 1 swons\n",
1953       "                                                                                                         [3] . [] = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [3]] swaack first choice i 2 swons 1 swons\n",
1954       "                                                                                                      [3] [] . = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [3]] swaack first choice i 2 swons 1 swons\n",
1955       "                                                                                                       False . [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [3]] swaack first choice i 2 swons 1 swons\n",
1956       "             False [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [3]] . swaack first choice i 2 swons 1 swons\n",
1957       "             [3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 2 swons 1 swons\n",
1958       "               [3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] False . choice i 2 swons 1 swons\n",
1959       "                              [3] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . i 2 swons 1 swons\n",
1960       "                                                                                                         [3] . uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons 2 swons 1 swons\n",
1961       "                                                                                                        3 [] . swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons 2 swons 1 swons\n",
1962       "                                                                                                        [] 3 . [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons 2 swons 1 swons\n",
1963       "                                                     [] 3 [[[] =] [pop []] [uncons swap] [dip swons] genrec] . dip swons 2 swons 1 swons\n",
1964       "                                                                                                          [] . [[] =] [pop []] [uncons swap] [dip swons] genrec 3 swons 2 swons 1 swons\n",
1965       "                                                                                                   [] [[] =] . [pop []] [uncons swap] [dip swons] genrec 3 swons 2 swons 1 swons\n",
1966       "                                                                                          [] [[] =] [pop []] . [uncons swap] [dip swons] genrec 3 swons 2 swons 1 swons\n",
1967       "                                                                            [] [[] =] [pop []] [uncons swap] . [dip swons] genrec 3 swons 2 swons 1 swons\n",
1968       "                                                                [] [[] =] [pop []] [uncons swap] [dip swons] . genrec 3 swons 2 swons 1 swons\n",
1969       "               [] [[] =] [pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] . ifte 3 swons 2 swons 1 swons\n",
1970       "          [] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [[]] [[] =] . infra first choice i 3 swons 2 swons 1 swons\n",
1971       "                                                                                                          [] . [] = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] []] swaack first choice i 3 swons 2 swons 1 swons\n",
1972       "                                                                                                       [] [] . = [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] []] swaack first choice i 3 swons 2 swons 1 swons\n",
1973       "                                                                                                        True . [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] []] swaack first choice i 3 swons 2 swons 1 swons\n",
1974       "               True [[pop []] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] []] . swaack first choice i 3 swons 2 swons 1 swons\n",
1975       "               [] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] [True] . first choice i 3 swons 2 swons 1 swons\n",
1976       "                 [] [uncons swap [[[] =] [pop []] [uncons swap] [dip swons] genrec] dip swons] [pop []] True . choice i 3 swons 2 swons 1 swons\n",
1977       "                                                                                                 [] [pop []] . i 3 swons 2 swons 1 swons\n",
1978       "                                                                                                          [] . pop [] 3 swons 2 swons 1 swons\n",
1979       "                                                                                                             . [] 3 swons 2 swons 1 swons\n",
1980       "                                                                                                          [] . 3 swons 2 swons 1 swons\n",
1981       "                                                                                                        [] 3 . swons 2 swons 1 swons\n",
1982       "                                                                                                        [] 3 . swap cons 2 swons 1 swons\n",
1983       "                                                                                                        3 [] . cons 2 swons 1 swons\n",
1984       "                                                                                                         [3] . 2 swons 1 swons\n",
1985       "                                                                                                       [3] 2 . swons 1 swons\n",
1986       "                                                                                                       [3] 2 . swap cons 1 swons\n",
1987       "                                                                                                       2 [3] . cons 1 swons\n",
1988       "                                                                                                       [2 3] . 1 swons\n",
1989       "                                                                                                     [2 3] 1 . swons\n",
1990       "                                                                                                     [2 3] 1 . swap cons\n",
1991       "                                                                                                     1 [2 3] . cons\n",
1992       "                                                                                                     [1 2 3] . \n"
1993      ]
1994     }
1995    ],
1996    "source": [
1997     "V('[1 2 3] [[] =] [pop []] [uncons swap] [dip swons] genrec')"
1998    ]
1999   },
2000   {
2001    "cell_type": "code",
2002    "execution_count": 27,
2003    "metadata": {},
2004    "outputs": [
2005     {
2006      "name": "stdout",
2007      "output_type": "stream",
2008      "text": [
2009       "                                                               . 3 [P] [pop c] [Ga] [dip F] genrec\n",
2010       "                                                             3 . [P] [pop c] [Ga] [dip F] genrec\n",
2011       "                                                         3 [P] . [pop c] [Ga] [dip F] genrec\n",
2012       "                                                 3 [P] [pop c] . [Ga] [dip F] genrec\n",
2013       "                                            3 [P] [pop c] [Ga] . [dip F] genrec\n",
2014       "                                    3 [P] [pop c] [Ga] [dip F] . genrec\n",
2015       "    3 [P] [pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] . ifte\n",
2016       "3 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] [3] [P] . infra first choice i\n",
2017       "                                                             3 . P [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 3] swaack first choice i\n",
2018       "                                                             3 . 1 <= [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 3] swaack first choice i\n",
2019       "                                                           3 1 . <= [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 3] swaack first choice i\n",
2020       "                                                         False . [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 3] swaack first choice i\n",
2021       "False [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 3] . swaack first choice i\n",
2022       "3 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] [False] . first choice i\n",
2023       "  3 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] False . choice i\n",
2024       "                3 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] . i\n",
2025       "                                                             3 . Ga [[P] [pop c] [Ga] [dip F] genrec] dip F\n",
2026       "                                                             3 . -- dup [[P] [pop c] [Ga] [dip F] genrec] dip F\n",
2027       "                                                             2 . dup [[P] [pop c] [Ga] [dip F] genrec] dip F\n",
2028       "                                                           2 2 . [[P] [pop c] [Ga] [dip F] genrec] dip F\n",
2029       "                         2 2 [[P] [pop c] [Ga] [dip F] genrec] . dip F\n",
2030       "                                                             2 . [P] [pop c] [Ga] [dip F] genrec 2 F\n",
2031       "                                                         2 [P] . [pop c] [Ga] [dip F] genrec 2 F\n",
2032       "                                                 2 [P] [pop c] . [Ga] [dip F] genrec 2 F\n",
2033       "                                            2 [P] [pop c] [Ga] . [dip F] genrec 2 F\n",
2034       "                                    2 [P] [pop c] [Ga] [dip F] . genrec 2 F\n",
2035       "    2 [P] [pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] . ifte 2 F\n",
2036       "2 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] [2] [P] . infra first choice i 2 F\n",
2037       "                                                             2 . P [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 2] swaack first choice i 2 F\n",
2038       "                                                             2 . 1 <= [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 2] swaack first choice i 2 F\n",
2039       "                                                           2 1 . <= [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 2] swaack first choice i 2 F\n",
2040       "                                                         False . [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 2] swaack first choice i 2 F\n",
2041       "False [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 2] . swaack first choice i 2 F\n",
2042       "2 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] [False] . first choice i 2 F\n",
2043       "  2 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] False . choice i 2 F\n",
2044       "                2 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] . i 2 F\n",
2045       "                                                             2 . Ga [[P] [pop c] [Ga] [dip F] genrec] dip F 2 F\n",
2046       "                                                             2 . -- dup [[P] [pop c] [Ga] [dip F] genrec] dip F 2 F\n",
2047       "                                                             1 . dup [[P] [pop c] [Ga] [dip F] genrec] dip F 2 F\n",
2048       "                                                           1 1 . [[P] [pop c] [Ga] [dip F] genrec] dip F 2 F\n",
2049       "                         1 1 [[P] [pop c] [Ga] [dip F] genrec] . dip F 2 F\n",
2050       "                                                             1 . [P] [pop c] [Ga] [dip F] genrec 1 F 2 F\n",
2051       "                                                         1 [P] . [pop c] [Ga] [dip F] genrec 1 F 2 F\n",
2052       "                                                 1 [P] [pop c] . [Ga] [dip F] genrec 1 F 2 F\n",
2053       "                                            1 [P] [pop c] [Ga] . [dip F] genrec 1 F 2 F\n",
2054       "                                    1 [P] [pop c] [Ga] [dip F] . genrec 1 F 2 F\n",
2055       "    1 [P] [pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] . ifte 1 F 2 F\n",
2056       "1 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] [1] [P] . infra first choice i 1 F 2 F\n",
2057       "                                                             1 . P [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 1] swaack first choice i 1 F 2 F\n",
2058       "                                                             1 . 1 <= [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 1] swaack first choice i 1 F 2 F\n",
2059       "                                                           1 1 . <= [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 1] swaack first choice i 1 F 2 F\n",
2060       "                                                          True . [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 1] swaack first choice i 1 F 2 F\n",
2061       " True [[pop c] [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] 1] . swaack first choice i 1 F 2 F\n",
2062       " 1 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] [True] . first choice i 1 F 2 F\n",
2063       "   1 [Ga [[P] [pop c] [Ga] [dip F] genrec] dip F] [pop c] True . choice i 1 F 2 F\n",
2064       "                                                     1 [pop c] . i 1 F 2 F\n",
2065       "                                                             1 . pop c 1 F 2 F\n",
2066       "                                                               . c 1 F 2 F\n",
2067       "                                                               . 0 1 F 2 F\n",
2068       "                                                             0 . 1 F 2 F\n",
2069       "                                                           0 1 . F 2 F\n",
2070       "                                                           0 1 . + 2 F\n",
2071       "                                                             1 . 2 F\n",
2072       "                                                           1 2 . F\n",
2073       "                                                           1 2 . +\n",
2074       "                                                             3 . \n"
2075      ]
2076     }
2077    ],
2078    "source": [
2079     "V('3 [P] [pop c] [Ga] [dip F] genrec')"
2080    ]
2081   },
2082   {
2083    "cell_type": "code",
2084    "execution_count": 28,
2085    "metadata": {},
2086    "outputs": [
2087     {
2088      "name": "stdout",
2089      "output_type": "stream",
2090      "text": [
2091       "                                                                         . 3 [P] [pop []] [Ga] [dip swons] genrec\n",
2092       "                                                                       3 . [P] [pop []] [Ga] [dip swons] genrec\n",
2093       "                                                                   3 [P] . [pop []] [Ga] [dip swons] genrec\n",
2094       "                                                          3 [P] [pop []] . [Ga] [dip swons] genrec\n",
2095       "                                                     3 [P] [pop []] [Ga] . [dip swons] genrec\n",
2096       "                                         3 [P] [pop []] [Ga] [dip swons] . genrec\n",
2097       "    3 [P] [pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] . ifte\n",
2098       "3 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] [3] [P] . infra first choice i\n",
2099       "                                                                       3 . P [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 3] swaack first choice i\n",
2100       "                                                                       3 . 1 <= [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 3] swaack first choice i\n",
2101       "                                                                     3 1 . <= [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 3] swaack first choice i\n",
2102       "                                                                   False . [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 3] swaack first choice i\n",
2103       "False [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 3] . swaack first choice i\n",
2104       "3 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] [False] . first choice i\n",
2105       "  3 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] False . choice i\n",
2106       "                 3 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] . i\n",
2107       "                                                                       3 . Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons\n",
2108       "                                                                       3 . -- dup [[P] [pop []] [Ga] [dip swons] genrec] dip swons\n",
2109       "                                                                       2 . dup [[P] [pop []] [Ga] [dip swons] genrec] dip swons\n",
2110       "                                                                     2 2 . [[P] [pop []] [Ga] [dip swons] genrec] dip swons\n",
2111       "                              2 2 [[P] [pop []] [Ga] [dip swons] genrec] . dip swons\n",
2112       "                                                                       2 . [P] [pop []] [Ga] [dip swons] genrec 2 swons\n",
2113       "                                                                   2 [P] . [pop []] [Ga] [dip swons] genrec 2 swons\n",
2114       "                                                          2 [P] [pop []] . [Ga] [dip swons] genrec 2 swons\n",
2115       "                                                     2 [P] [pop []] [Ga] . [dip swons] genrec 2 swons\n",
2116       "                                         2 [P] [pop []] [Ga] [dip swons] . genrec 2 swons\n",
2117       "    2 [P] [pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] . ifte 2 swons\n",
2118       "2 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] [2] [P] . infra first choice i 2 swons\n",
2119       "                                                                       2 . P [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons\n",
2120       "                                                                       2 . 1 <= [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons\n",
2121       "                                                                     2 1 . <= [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons\n",
2122       "                                                                   False . [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 2] swaack first choice i 2 swons\n",
2123       "False [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 2] . swaack first choice i 2 swons\n",
2124       "2 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] [False] . first choice i 2 swons\n",
2125       "  2 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] False . choice i 2 swons\n",
2126       "                 2 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] . i 2 swons\n",
2127       "                                                                       2 . Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons 2 swons\n",
2128       "                                                                       2 . -- dup [[P] [pop []] [Ga] [dip swons] genrec] dip swons 2 swons\n",
2129       "                                                                       1 . dup [[P] [pop []] [Ga] [dip swons] genrec] dip swons 2 swons\n",
2130       "                                                                     1 1 . [[P] [pop []] [Ga] [dip swons] genrec] dip swons 2 swons\n",
2131       "                              1 1 [[P] [pop []] [Ga] [dip swons] genrec] . dip swons 2 swons\n",
2132       "                                                                       1 . [P] [pop []] [Ga] [dip swons] genrec 1 swons 2 swons\n",
2133       "                                                                   1 [P] . [pop []] [Ga] [dip swons] genrec 1 swons 2 swons\n",
2134       "                                                          1 [P] [pop []] . [Ga] [dip swons] genrec 1 swons 2 swons\n",
2135       "                                                     1 [P] [pop []] [Ga] . [dip swons] genrec 1 swons 2 swons\n",
2136       "                                         1 [P] [pop []] [Ga] [dip swons] . genrec 1 swons 2 swons\n",
2137       "    1 [P] [pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] . ifte 1 swons 2 swons\n",
2138       "1 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] [1] [P] . infra first choice i 1 swons 2 swons\n",
2139       "                                                                       1 . P [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons\n",
2140       "                                                                       1 . 1 <= [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons\n",
2141       "                                                                     1 1 . <= [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons\n",
2142       "                                                                    True . [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 1] swaack first choice i 1 swons 2 swons\n",
2143       " True [[pop []] [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] 1] . swaack first choice i 1 swons 2 swons\n",
2144       " 1 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] [True] . first choice i 1 swons 2 swons\n",
2145       "   1 [Ga [[P] [pop []] [Ga] [dip swons] genrec] dip swons] [pop []] True . choice i 1 swons 2 swons\n",
2146       "                                                              1 [pop []] . i 1 swons 2 swons\n",
2147       "                                                                       1 . pop [] 1 swons 2 swons\n",
2148       "                                                                         . [] 1 swons 2 swons\n",
2149       "                                                                      [] . 1 swons 2 swons\n",
2150       "                                                                    [] 1 . swons 2 swons\n",
2151       "                                                                    [] 1 . swap cons 2 swons\n",
2152       "                                                                    1 [] . cons 2 swons\n",
2153       "                                                                     [1] . 2 swons\n",
2154       "                                                                   [1] 2 . swons\n",
2155       "                                                                   [1] 2 . swap cons\n",
2156       "                                                                   2 [1] . cons\n",
2157       "                                                                   [2 1] . \n"
2158      ]
2159     }
2160    ],
2161    "source": [
2162     "V('3 [P] [pop []] [Ga] [dip swons] genrec')"
2163    ]
2164   },
2165   {
2166    "cell_type": "code",
2167    "execution_count": 29,
2168    "metadata": {},
2169    "outputs": [
2170     {
2171      "name": "stdout",
2172      "output_type": "stream",
2173      "text": [
2174       "                                                                                               . [2 1] [[] =] [pop c] [uncons swap] [dip F] genrec\n",
2175       "                                                                                         [2 1] . [[] =] [pop c] [uncons swap] [dip F] genrec\n",
2176       "                                                                                  [2 1] [[] =] . [pop c] [uncons swap] [dip F] genrec\n",
2177       "                                                                          [2 1] [[] =] [pop c] . [uncons swap] [dip F] genrec\n",
2178       "                                                            [2 1] [[] =] [pop c] [uncons swap] . [dip F] genrec\n",
2179       "                                                    [2 1] [[] =] [pop c] [uncons swap] [dip F] . genrec\n",
2180       "        [2 1] [[] =] [pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] . ifte\n",
2181       "[2 1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] [[2 1]] [[] =] . infra first choice i\n",
2182       "                                                                                         [2 1] . [] = [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [2 1]] swaack first choice i\n",
2183       "                                                                                      [2 1] [] . = [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [2 1]] swaack first choice i\n",
2184       "                                                                                         False . [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [2 1]] swaack first choice i\n",
2185       "       False [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [2 1]] . swaack first choice i\n",
2186       "       [2 1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] [False] . first choice i\n",
2187       "         [2 1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] False . choice i\n",
2188       "                       [2 1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] . i\n",
2189       "                                                                                         [2 1] . uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F\n",
2190       "                                                                                         2 [1] . swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F\n",
2191       "                                                                                         [1] 2 . [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F\n",
2192       "                                           [1] 2 [[[] =] [pop c] [uncons swap] [dip F] genrec] . dip F\n",
2193       "                                                                                           [1] . [[] =] [pop c] [uncons swap] [dip F] genrec 2 F\n",
2194       "                                                                                    [1] [[] =] . [pop c] [uncons swap] [dip F] genrec 2 F\n",
2195       "                                                                            [1] [[] =] [pop c] . [uncons swap] [dip F] genrec 2 F\n",
2196       "                                                              [1] [[] =] [pop c] [uncons swap] . [dip F] genrec 2 F\n",
2197       "                                                      [1] [[] =] [pop c] [uncons swap] [dip F] . genrec 2 F\n",
2198       "          [1] [[] =] [pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] . ifte 2 F\n",
2199       "    [1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] [[1]] [[] =] . infra first choice i 2 F\n",
2200       "                                                                                           [1] . [] = [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [1]] swaack first choice i 2 F\n",
2201       "                                                                                        [1] [] . = [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [1]] swaack first choice i 2 F\n",
2202       "                                                                                         False . [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [1]] swaack first choice i 2 F\n",
2203       "         False [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [1]] . swaack first choice i 2 F\n",
2204       "         [1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] [False] . first choice i 2 F\n",
2205       "           [1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] False . choice i 2 F\n",
2206       "                         [1] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] . i 2 F\n",
2207       "                                                                                           [1] . uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F 2 F\n",
2208       "                                                                                          1 [] . swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F 2 F\n",
2209       "                                                                                          [] 1 . [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F 2 F\n",
2210       "                                            [] 1 [[[] =] [pop c] [uncons swap] [dip F] genrec] . dip F 2 F\n",
2211       "                                                                                            [] . [[] =] [pop c] [uncons swap] [dip F] genrec 1 F 2 F\n",
2212       "                                                                                     [] [[] =] . [pop c] [uncons swap] [dip F] genrec 1 F 2 F\n",
2213       "                                                                             [] [[] =] [pop c] . [uncons swap] [dip F] genrec 1 F 2 F\n",
2214       "                                                               [] [[] =] [pop c] [uncons swap] . [dip F] genrec 1 F 2 F\n",
2215       "                                                       [] [[] =] [pop c] [uncons swap] [dip F] . genrec 1 F 2 F\n",
2216       "           [] [[] =] [pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] . ifte 1 F 2 F\n",
2217       "      [] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] [[]] [[] =] . infra first choice i 1 F 2 F\n",
2218       "                                                                                            [] . [] = [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] []] swaack first choice i 1 F 2 F\n",
2219       "                                                                                         [] [] . = [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] []] swaack first choice i 1 F 2 F\n",
2220       "                                                                                          True . [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] []] swaack first choice i 1 F 2 F\n",
2221       "           True [[pop c] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] []] . swaack first choice i 1 F 2 F\n",
2222       "           [] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] [True] . first choice i 1 F 2 F\n",
2223       "             [] [uncons swap [[[] =] [pop c] [uncons swap] [dip F] genrec] dip F] [pop c] True . choice i 1 F 2 F\n",
2224       "                                                                                    [] [pop c] . i 1 F 2 F\n",
2225       "                                                                                            [] . pop c 1 F 2 F\n",
2226       "                                                                                               . c 1 F 2 F\n",
2227       "                                                                                               . 0 1 F 2 F\n",
2228       "                                                                                             0 . 1 F 2 F\n",
2229       "                                                                                           0 1 . F 2 F\n",
2230       "                                                                                           0 1 . + 2 F\n",
2231       "                                                                                             1 . 2 F\n",
2232       "                                                                                           1 2 . F\n",
2233       "                                                                                           1 2 . +\n",
2234       "                                                                                             3 . \n"
2235      ]
2236     }
2237    ],
2238    "source": [
2239     "V('[2 1] [[] =] [pop c ] [uncons swap] [dip F] genrec')"
2240    ]
2241   },
2242   {
2243    "cell_type": "markdown",
2244    "metadata": {},
2245    "source": [
2246     "## Appendix - Fun with Symbols\n",
2247     "\n",
2248     "    |[ (c, F), (G, P) ]| == (|c, F|) • [(G, P)]\n",
2249     "\n",
2250     "[\"Bananas, Lenses, & Barbed Wire\"](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.125)\n",
2251     "\n",
2252     "    (|...|)  [(...)]  [<...>]\n",
2253     "\n",
2254     "I think they are having slightly too much fun with the symbols.\n",
2255     "\n",
2256     "\"Too much is always better than not enough.\""
2257    ]
2258   }
2259  ],
2260  "metadata": {
2261   "kernelspec": {
2262    "display_name": "Python 2",
2263    "language": "python",
2264    "name": "python2"
2265   },
2266   "language_info": {
2267    "codemirror_mode": {
2268     "name": "ipython",
2269     "version": 2
2270    },
2271    "file_extension": ".py",
2272    "mimetype": "text/x-python",
2273    "name": "python",
2274    "nbconvert_exporter": "python",
2275    "pygments_lexer": "ipython2",
2276    "version": "2.7.12"
2277   }
2278  },
2279  "nbformat": 4,
2280  "nbformat_minor": 2
2281 }