OSDN Git Service

More update to 4.3.0
[joypy/Thun.git] / docs / fun_with_scan.rst
index ff54dc4..8ce5003 100644 (file)
@@ -1,5 +1,4 @@
-
-.. code:: ipython2
+.. code:: ipython3
 
     from notebook_preamble import D, DefinitionWrapper, J, V, define
 
@@ -8,6 +7,9 @@ On "Two Exercises Found in a Book on Algorithmics"
 
 Bird & Meertens
 
+`PDF paper available
+here <https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.694.2614>`__
+
 Define ``scan`` in terms of a reduction.
 ----------------------------------------
 
@@ -29,7 +31,7 @@ Define ``scan`` in terms of a reduction.
 
 ::
 
-    â¨\82\x = f(a)⨂f(b)⨂...⨂f(z)
+    â¨\81\x = f(a)⨂f(b)⨂...⨂f(z)
 
 Designing the Recursive Function
 --------------------------------
@@ -140,7 +142,7 @@ Handling the Last Term
 
 This works to a point, but it throws away the last term:
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('[1 2 3] [size 1 <=] [pop []] [[[+] infra] dupdip first] [dip swons] genrec')
 
@@ -152,7 +154,7 @@ This works to a point, but it throws away the last term:
 
 Hmm... Let's take out the ``pop`` for a sec...
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('[1 2 3] [size 1 <=] [[]] [[[+] infra] dupdip first] [dip swons] genrec')
 
@@ -167,7 +169,7 @@ stack and ``swons``'s the new terms onto that. If we leave out that
 empty list, they will be ``swons``'d onto that list that already has the
 last item.
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('[1 2 3] [size 1 <=] [] [[[+] infra] dupdip first] [dip swons] genrec')
 
@@ -201,11 +203,11 @@ And so:
 
     scan == [infra] cons [dupdip first] cons [size 1 <=] [] roll< [dip swons] genrec
 
-.. code:: ipython2
+.. code:: ipython3
 
-    define('scan == [infra] cons [dupdip first] cons [size 1 <=] [] roll< [dip swons] genrec')
+    define('scan [infra] cons [dupdip first] cons [size 1 <=] [] roll< [dip swons] genrec')
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('[1 2 3 4] [+] scan')
 
@@ -215,7 +217,7 @@ And so:
     [1 3 6 10]
 
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('[1 2 3 4] [*] scan')
 
@@ -225,7 +227,7 @@ And so:
     [1 2 6 24]
 
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('[1 2 3 4 5 6 7] [neg +] scan')
 
@@ -255,7 +257,7 @@ Problem 2.
 
     Unlines = uncons ['\n' swap + +] step
 
-.. code:: ipython2
+.. code:: ipython3
 
     J('["hello" "world"] uncons ["\n" swap + +] step')