diff --git a/Makefile b/Makefile index bfc2bae..90c3f7f 100644 --- a/Makefile +++ b/Makefile @@ -27,3 +27,6 @@ docs: cd ./docs && python -m nbconvert --to html *.ipynb cd ./docs && python -m nbconvert --to markdown *.ipynb cd ./docs && python -m nbconvert --to rst *.ipynb + + +%.md : %.ipynb ; diff --git a/docs/0. This Implementation of Joy in Python.ipynb b/docs/0. This Implementation of Joy in Python.ipynb index a97a93e..8b3ce7e 100644 --- a/docs/0. This Implementation of Joy in Python.ipynb +++ b/docs/0. This Implementation of Joy in Python.ipynb @@ -5,6 +5,7 @@ "metadata": {}, "source": [ "# Joypy\n", + "\n", "## Joy in Python\n", "\n", "This implementation is meant as a tool for exploring the programming model and method of Joy. Python seems like a great implementation language for Joy for several reasons.\n", diff --git a/docs/4. Replacing Functions in the Dictionary.html b/docs/4. Replacing Functions in the Dictionary.html deleted file mode 100644 index 6cfc928..0000000 --- a/docs/4. Replacing Functions in the Dictionary.html +++ /dev/null @@ -1,12084 +0,0 @@ - - - -4. Replacing Functions in the Dictionary - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-

Preamble

-
-
-
-
-
-
In [1]:
-
-
-
from notebook_preamble import D, J, V
-
- -
-
-
- -
-
-
-
-
-

A long trace

-
-
-
-
-
-
In [2]:
-
-
-
V('[23 18] average')
-
- -
-
-
- -
-
- - -
- -
- - -
-
                                  . [23 18] average
-                          [23 18] . average
-                          [23 18] . [sum 1.0 *] [size] cleave /
-              [23 18] [sum 1.0 *] . [size] cleave /
-       [23 18] [sum 1.0 *] [size] . cleave /
-       [23 18] [sum 1.0 *] [size] . [i] app2 [popd] dip /
-   [23 18] [sum 1.0 *] [size] [i] . app2 [popd] dip /
-[23 18] [[sum 1.0 *] [23 18]] [i] . infra first [[size] [23 18]] [i] infra first [popd] dip /
-              [23 18] [sum 1.0 *] . i [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                          [23 18] . sum 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                               41 . 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                           41 1.0 . * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                             41.0 . [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                   41.0 [[23 18]] . swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                   [23 18] [41.0] . first [[size] [23 18]] [i] infra first [popd] dip /
-                     [23 18] 41.0 . [[size] [23 18]] [i] infra first [popd] dip /
-    [23 18] 41.0 [[size] [23 18]] . [i] infra first [popd] dip /
-[23 18] 41.0 [[size] [23 18]] [i] . infra first [popd] dip /
-                   [23 18] [size] . i [41.0 [23 18]] swaack first [popd] dip /
-                          [23 18] . size [41.0 [23 18]] swaack first [popd] dip /
-                          [23 18] . 0 swap [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                        [23 18] 0 . swap [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                        0 [23 18] . [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-               0 [23 18] [pop ++] . step [41.0 [23 18]] swaack first [popd] dip /
-                    0 23 [pop ++] . i [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                             0 23 . pop ++ [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                                0 . ++ [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                                1 . [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                           1 [18] . [pop ++] step [41.0 [23 18]] swaack first [popd] dip /
-                  1 [18] [pop ++] . step [41.0 [23 18]] swaack first [popd] dip /
-                    1 18 [pop ++] . i [41.0 [23 18]] swaack first [popd] dip /
-                             1 18 . pop ++ [41.0 [23 18]] swaack first [popd] dip /
-                                1 . ++ [41.0 [23 18]] swaack first [popd] dip /
-                                2 . [41.0 [23 18]] swaack first [popd] dip /
-                 2 [41.0 [23 18]] . swaack first [popd] dip /
-                 [23 18] 41.0 [2] . first [popd] dip /
-                   [23 18] 41.0 2 . [popd] dip /
-            [23 18] 41.0 2 [popd] . dip /
-                     [23 18] 41.0 . popd 2 /
-                             41.0 . 2 /
-                           41.0 2 . /
-                             20.5 . 
-
-
-
- -
-
- -
-
-
-
-
-

Replacing sum and size with "compiled" versions.

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

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

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

- -
-
-
-
-
-
In [5]:
-
-
-
from joy.library import SimpleFunctionWrapper, primitives
-from joy.utils.stack import iter_stack
-
-
-@SimpleFunctionWrapper
-def size(stack):
-    '''Return the size of the sequence on the stack.'''
-    sequence, stack = stack
-    n = 0
-    for _ in iter_stack(sequence):
-        n += 1
-    return n, stack
-
-
-sum_ = next(p for p in primitives if p.name == 'sum')
-
- -
-
-
- -
-
-
-
-
-

Now we replace them old versions in the dictionary with the new versions and re-evaluate the expression.

- -
-
-
-
-
-
In [6]:
-
-
-
old_sum, D['sum'] = D['sum'], sum_
-old_size, D['size'] = D['size'], size
-
- -
-
-
- -
-
-
-
-
-

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

- -
-
-
-
-
-
In [7]:
-
-
-
V('[23 18] average')
-
- -
-
-
- -
-
- - -
- -
- - -
-
                                  . [23 18] average
-                          [23 18] . average
-                          [23 18] . [sum 1.0 *] [size] cleave /
-              [23 18] [sum 1.0 *] . [size] cleave /
-       [23 18] [sum 1.0 *] [size] . cleave /
-       [23 18] [sum 1.0 *] [size] . [i] app2 [popd] dip /
-   [23 18] [sum 1.0 *] [size] [i] . app2 [popd] dip /
-[23 18] [[sum 1.0 *] [23 18]] [i] . infra first [[size] [23 18]] [i] infra first [popd] dip /
-              [23 18] [sum 1.0 *] . i [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                          [23 18] . sum 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                               41 . 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                           41 1.0 . * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                             41.0 . [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                   41.0 [[23 18]] . swaack first [[size] [23 18]] [i] infra first [popd] dip /
-                   [23 18] [41.0] . first [[size] [23 18]] [i] infra first [popd] dip /
-                     [23 18] 41.0 . [[size] [23 18]] [i] infra first [popd] dip /
-    [23 18] 41.0 [[size] [23 18]] . [i] infra first [popd] dip /
-[23 18] 41.0 [[size] [23 18]] [i] . infra first [popd] dip /
-                   [23 18] [size] . i [41.0 [23 18]] swaack first [popd] dip /
-                          [23 18] . size [41.0 [23 18]] swaack first [popd] dip /
-                                2 . [41.0 [23 18]] swaack first [popd] dip /
-                 2 [41.0 [23 18]] . swaack first [popd] dip /
-                 [23 18] 41.0 [2] . first [popd] dip /
-                   [23 18] 41.0 2 . [popd] dip /
-            [23 18] 41.0 2 [popd] . dip /
-                     [23 18] 41.0 . popd 2 /
-                             41.0 . 2 /
-                           41.0 2 . /
-                             20.5 . 
-
-
-
- -
-
- -
-
-
- - - - - - diff --git a/docs/4. Replacing Functions in the Dictionary.md b/docs/4. Replacing Functions in the Dictionary.md deleted file mode 100644 index 352dae8..0000000 --- a/docs/4. Replacing Functions in the Dictionary.md +++ /dev/null @@ -1,149 +0,0 @@ - -### Preamble - - -```python -from notebook_preamble import D, J, V -``` - -### A long trace - - -```python -V('[23 18] average') -``` - - . [23 18] average - [23 18] . average - [23 18] . [sum 1.0 *] [size] cleave / - [23 18] [sum 1.0 *] . [size] cleave / - [23 18] [sum 1.0 *] [size] . cleave / - [23 18] [sum 1.0 *] [size] . [i] app2 [popd] dip / - [23 18] [sum 1.0 *] [size] [i] . app2 [popd] dip / - [23 18] [[sum 1.0 *] [23 18]] [i] . infra first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [sum 1.0 *] . i [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] . sum 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 . 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 1.0 . * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 . [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 [[23 18]] . swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [41.0] . first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 . [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] . [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] [i] . infra first [popd] dip / - [23 18] [size] . i [41.0 [23 18]] swaack first [popd] dip / - [23 18] . size [41.0 [23 18]] swaack first [popd] dip / - [23 18] . 0 swap [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - [23 18] 0 . swap [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 [23 18] . [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 [23 18] [pop ++] . step [41.0 [23 18]] swaack first [popd] dip / - 0 23 [pop ++] . i [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 23 . pop ++ [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 . ++ [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 1 . [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 1 [18] . [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 1 [18] [pop ++] . step [41.0 [23 18]] swaack first [popd] dip / - 1 18 [pop ++] . i [41.0 [23 18]] swaack first [popd] dip / - 1 18 . pop ++ [41.0 [23 18]] swaack first [popd] dip / - 1 . ++ [41.0 [23 18]] swaack first [popd] dip / - 2 . [41.0 [23 18]] swaack first [popd] dip / - 2 [41.0 [23 18]] . swaack first [popd] dip / - [23 18] 41.0 [2] . first [popd] dip / - [23 18] 41.0 2 . [popd] dip / - [23 18] 41.0 2 [popd] . dip / - [23 18] 41.0 . popd 2 / - 41.0 . 2 / - 41.0 2 . / - 20.5 . - - -### Replacing `sum` and `size` with "compiled" versions. - -Both `sum` and `size` are [catamorphisms](https://en.wikipedia.org/wiki/Catamorphism), they each convert a sequence to a single value. - - -```python -J('[sum] help') -``` - - Given a quoted sequence of numbers return the sum. - - sum == 0 swap [+] step - - - - -```python -J('[size] help') -``` - - 0 swap [pop ++] step - - - -We can use "compiled" versions (they're not really compiled in this case, they're hand-written in Python) to speed up evaluation and make the trace more readable. The `sum` function is already in the library. It gets shadowed by the definition version above during `initialize()`. - - -```python -from joy.library import SimpleFunctionWrapper, primitives -from joy.utils.stack import iter_stack - - -@SimpleFunctionWrapper -def size(stack): - '''Return the size of the sequence on the stack.''' - sequence, stack = stack - n = 0 - for _ in iter_stack(sequence): - n += 1 - return n, stack - - -sum_ = next(p for p in primitives if p.name == 'sum') -``` - -Now we replace them old versions in the dictionary with the new versions and re-evaluate the expression. - - -```python -old_sum, D['sum'] = D['sum'], sum_ -old_size, D['size'] = D['size'], size -``` - -You can see that `size` and `sum` now execute in a single step. - - -```python -V('[23 18] average') -``` - - . [23 18] average - [23 18] . average - [23 18] . [sum 1.0 *] [size] cleave / - [23 18] [sum 1.0 *] . [size] cleave / - [23 18] [sum 1.0 *] [size] . cleave / - [23 18] [sum 1.0 *] [size] . [i] app2 [popd] dip / - [23 18] [sum 1.0 *] [size] [i] . app2 [popd] dip / - [23 18] [[sum 1.0 *] [23 18]] [i] . infra first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [sum 1.0 *] . i [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] . sum 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 . 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 1.0 . * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 . [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 [[23 18]] . swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [41.0] . first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 . [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] . [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] [i] . infra first [popd] dip / - [23 18] [size] . i [41.0 [23 18]] swaack first [popd] dip / - [23 18] . size [41.0 [23 18]] swaack first [popd] dip / - 2 . [41.0 [23 18]] swaack first [popd] dip / - 2 [41.0 [23 18]] . swaack first [popd] dip / - [23 18] 41.0 [2] . first [popd] dip / - [23 18] 41.0 2 . [popd] dip / - [23 18] 41.0 2 [popd] . dip / - [23 18] 41.0 . popd 2 / - 41.0 . 2 / - 41.0 2 . / - 20.5 . - diff --git a/docs/4. Replacing Functions in the Dictionary.rst b/docs/4. Replacing Functions in the Dictionary.rst deleted file mode 100644 index f3d4dd0..0000000 --- a/docs/4. Replacing Functions in the Dictionary.rst +++ /dev/null @@ -1,164 +0,0 @@ - -Preamble -~~~~~~~~ - -.. code:: ipython2 - - from notebook_preamble import D, J, V - -A long trace -~~~~~~~~~~~~ - -.. code:: ipython2 - - V('[23 18] average') - - -.. parsed-literal:: - - . [23 18] average - [23 18] . average - [23 18] . [sum 1.0 *] [size] cleave / - [23 18] [sum 1.0 *] . [size] cleave / - [23 18] [sum 1.0 *] [size] . cleave / - [23 18] [sum 1.0 *] [size] . [i] app2 [popd] dip / - [23 18] [sum 1.0 *] [size] [i] . app2 [popd] dip / - [23 18] [[sum 1.0 *] [23 18]] [i] . infra first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [sum 1.0 *] . i [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] . sum 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 . 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 1.0 . * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 . [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 [[23 18]] . swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [41.0] . first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 . [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] . [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] [i] . infra first [popd] dip / - [23 18] [size] . i [41.0 [23 18]] swaack first [popd] dip / - [23 18] . size [41.0 [23 18]] swaack first [popd] dip / - [23 18] . 0 swap [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - [23 18] 0 . swap [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 [23 18] . [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 [23 18] [pop ++] . step [41.0 [23 18]] swaack first [popd] dip / - 0 23 [pop ++] . i [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 23 . pop ++ [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 0 . ++ [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 1 . [18] [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 1 [18] . [pop ++] step [41.0 [23 18]] swaack first [popd] dip / - 1 [18] [pop ++] . step [41.0 [23 18]] swaack first [popd] dip / - 1 18 [pop ++] . i [41.0 [23 18]] swaack first [popd] dip / - 1 18 . pop ++ [41.0 [23 18]] swaack first [popd] dip / - 1 . ++ [41.0 [23 18]] swaack first [popd] dip / - 2 . [41.0 [23 18]] swaack first [popd] dip / - 2 [41.0 [23 18]] . swaack first [popd] dip / - [23 18] 41.0 [2] . first [popd] dip / - [23 18] 41.0 2 . [popd] dip / - [23 18] 41.0 2 [popd] . dip / - [23 18] 41.0 . popd 2 / - 41.0 . 2 / - 41.0 2 . / - 20.5 . - - -Replacing ``sum`` and ``size`` with "compiled" versions. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Both ``sum`` and ``size`` are -`catamorphisms `__, they -each convert a sequence to a single value. - -.. code:: ipython2 - - J('[sum] help') - - -.. parsed-literal:: - - Given a quoted sequence of numbers return the sum. - - sum == 0 swap [+] step - - - -.. code:: ipython2 - - J('[size] help') - - -.. parsed-literal:: - - 0 swap [pop ++] step - - - -We can use "compiled" versions (they're not really compiled in this -case, they're hand-written in Python) to speed up evaluation and make -the trace more readable. The ``sum`` function is already in the library. -It gets shadowed by the definition version above during -``initialize()``. - -.. code:: ipython2 - - from joy.library import SimpleFunctionWrapper, primitives - from joy.utils.stack import iter_stack - - - @SimpleFunctionWrapper - def size(stack): - '''Return the size of the sequence on the stack.''' - sequence, stack = stack - n = 0 - for _ in iter_stack(sequence): - n += 1 - return n, stack - - - sum_ = next(p for p in primitives if p.name == 'sum') - -Now we replace them old versions in the dictionary with the new versions -and re-evaluate the expression. - -.. code:: ipython2 - - old_sum, D['sum'] = D['sum'], sum_ - old_size, D['size'] = D['size'], size - -You can see that ``size`` and ``sum`` now execute in a single step. - -.. code:: ipython2 - - V('[23 18] average') - - -.. parsed-literal:: - - . [23 18] average - [23 18] . average - [23 18] . [sum 1.0 *] [size] cleave / - [23 18] [sum 1.0 *] . [size] cleave / - [23 18] [sum 1.0 *] [size] . cleave / - [23 18] [sum 1.0 *] [size] . [i] app2 [popd] dip / - [23 18] [sum 1.0 *] [size] [i] . app2 [popd] dip / - [23 18] [[sum 1.0 *] [23 18]] [i] . infra first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [sum 1.0 *] . i [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] . sum 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 . 1.0 * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41 1.0 . * [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 . [[23 18]] swaack first [[size] [23 18]] [i] infra first [popd] dip / - 41.0 [[23 18]] . swaack first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] [41.0] . first [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 . [[size] [23 18]] [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] . [i] infra first [popd] dip / - [23 18] 41.0 [[size] [23 18]] [i] . infra first [popd] dip / - [23 18] [size] . i [41.0 [23 18]] swaack first [popd] dip / - [23 18] . size [41.0 [23 18]] swaack first [popd] dip / - 2 . [41.0 [23 18]] swaack first [popd] dip / - 2 [41.0 [23 18]] . swaack first [popd] dip / - [23 18] 41.0 [2] . first [popd] dip / - [23 18] 41.0 2 . [popd] dip / - [23 18] 41.0 2 [popd] . dip / - [23 18] 41.0 . popd 2 / - 41.0 . 2 / - 41.0 2 . / - 20.5 . - diff --git a/docs/Generator Programs.html b/docs/Generator Programs.html index aaa6ffe..775f6d2 100644 --- a/docs/Generator Programs.html +++ b/docs/Generator Programs.html @@ -12218,7 +12218,7 @@ G == [direco] cons [swap] swoncat cons
-

Generating Multiples of Three and Five

Look at the treatment of the Project Euler Problem One in Developing a Program.ipynb and you'll see that we might be interested in generating an endless cycle of:

+

Generating Multiples of Three and Five

Look at the treatment of the Project Euler Problem One in the "Developing a Program" notebook and you'll see that we might be interested in generating an endless cycle of:

3 2 1 3 1 2 3
 
diff --git a/docs/Generator Programs.md b/docs/Generator Programs.md
index d22f64f..b10028c 100644
--- a/docs/Generator Programs.md	
+++ b/docs/Generator Programs.md	
@@ -164,7 +164,7 @@ J('23 [dup ++] G 5 [x] times')
 
 
 ## Generating Multiples of Three and Five
-Look at the treatment of the Project Euler Problem One in [Developing a Program.ipynb](./Developing a Program.ipynb) and you'll see that we might be interested in generating an endless cycle of:
+Look at the treatment of the Project Euler Problem One in the "Developing a Program" notebook and you'll see that we might be interested in generating an endless cycle of:
 
     3 2 1 3 1 2 3
 
diff --git a/docs/Generator Programs.rst b/docs/Generator Programs.rst
index d5ee3ca..a201c0d 100644
--- a/docs/Generator Programs.rst	
+++ b/docs/Generator Programs.rst	
@@ -208,9 +208,9 @@ with the ``x`` combinator.
 Generating Multiples of Three and Five
 --------------------------------------
 
-Look at the treatment of the Project Euler Problem One in `Developing a
-Program.ipynb <./Developing%20a%20Program.ipynb>`__ and you'll see that
-we might be interested in generating an endless cycle of:
+Look at the treatment of the Project Euler Problem One in the
+"Developing a Program" notebook and you'll see that we might be
+interested in generating an endless cycle of:
 
 ::
 
diff --git a/docs/4. Replacing Functions in the Dictionary.ipynb b/docs/Replacing.ipynb
similarity index 99%
rename from docs/4. Replacing Functions in the Dictionary.ipynb
rename to docs/Replacing.ipynb
index c56d42b..fc1b436 100644
--- a/docs/4. Replacing Functions in the Dictionary.ipynb	
+++ b/docs/Replacing.ipynb
@@ -26,9 +26,7 @@
   {
    "cell_type": "code",
    "execution_count": 2,
-   "metadata": {
-    "scrolled": true
-   },
+   "metadata": {},
    "outputs": [
     {
      "name": "stdout",
diff --git a/docs/Zipper.html b/docs/Zipper.html
index cbab02b..70bff52 100644
--- a/docs/Zipper.html
+++ b/docs/Zipper.html
@@ -11778,14 +11778,6 @@ div#notebook {
 

This notebook is about using the "zipper" with joy datastructures. See the Zipper wikipedia entry or the original paper: "FUNCTIONAL PEARL The Zipper" by Gérard Huet

Given a datastructure on the stack we can navigate through it, modify it, and rebuild it using the "zipper" technique.

-
-
- -
-
-
-
-

Preamble

diff --git a/docs/Zipper.ipynb b/docs/Zipper.ipynb index ceec382..744aadb 100644 --- a/docs/Zipper.ipynb +++ b/docs/Zipper.ipynb @@ -6,16 +6,10 @@ "source": [ "This notebook is about using the \"zipper\" with joy datastructures. See the [Zipper wikipedia entry](https://en.wikipedia.org/wiki/Zipper_%28data_structure%29) or the original paper: [\"FUNCTIONAL PEARL The Zipper\" by Gérard Huet](https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf)\n", "\n", + "\n", "Given a datastructure on the stack we can navigate through it, modify it, and rebuild it using the \"zipper\" technique." ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Preamble" - ] - }, { "cell_type": "code", "execution_count": 1, diff --git a/docs/Zipper.md b/docs/Zipper.md index 02e8690..a91f180 100644 --- a/docs/Zipper.md +++ b/docs/Zipper.md @@ -1,9 +1,8 @@ This notebook is about using the "zipper" with joy datastructures. See the [Zipper wikipedia entry](https://en.wikipedia.org/wiki/Zipper_%28data_structure%29) or the original paper: ["FUNCTIONAL PEARL The Zipper" by Gérard Huet](https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf) -Given a datastructure on the stack we can navigate through it, modify it, and rebuild it using the "zipper" technique. -### Preamble +Given a datastructure on the stack we can navigate through it, modify it, and rebuild it using the "zipper" technique. ```python diff --git a/docs/Zipper.rst b/docs/Zipper.rst index 8bc5e5f..fa4481b 100644 --- a/docs/Zipper.rst +++ b/docs/Zipper.rst @@ -8,9 +8,6 @@ Huet
  • Replacing Functions in the Dictionary
  • diff --git a/docs/sphinx_docs/notebooks/Replacing.rst b/docs/sphinx_docs/notebooks/Replacing.rst index 62ea07f..5ed8d14 100644 --- a/docs/sphinx_docs/notebooks/Replacing.rst +++ b/docs/sphinx_docs/notebooks/Replacing.rst @@ -1,15 +1,13 @@ -************************************* -Replacing Functions in the Dictionary -************************************* +Replacing Functions in the Dictionary +===================================== .. code:: ipython2 from notebook_preamble import D, J, V - A long trace -~~~~~~~~~~~~ +------------ .. code:: ipython2 @@ -62,8 +60,8 @@ A long trace 20.5 . -Replacing ``size`` with a Python Version -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Replacing ``size`` with a Python version +---------------------------------------- Both ``sum`` and ``size`` each convert a sequence to a single value. @@ -71,10 +69,10 @@ Both ``sum`` and ``size`` each convert a sequence to a single value. sum == 0 swap [+] step size == 0 swap [pop ++] step - -An efficient ``sum`` function is already in the library. But for ``size`` we can use -a "compiled" version hand-written in Python to speed up evaluation and make the trace more readable. +An efficient ``sum`` function is already in the library. But for +``size`` we can use a “compiled” version hand-written in Python to speed +up evaluation and make the trace more readable. .. code:: ipython2 @@ -98,11 +96,10 @@ and re-evaluate the expression. D['size'] = size - A shorter trace -~~~~~~~~~~~~~~~~~~~~ +--------------- -You can see that ``size`` and ``sum`` now execute in a single step. +You can see that ``size`` now executes in a single step. .. code:: ipython2