OSDN Git Service

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