[Joypy-announce] joypy/Joypy: Add example code, rebuild docs.

Back to archive index
scmno****@osdn***** scmno****@osdn*****
Sun May 31 15:39:40 JST 2020


changeset 33cf8e5aec62 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=33cf8e5aec62
user: Simon Forman <sform****@hushm*****>
date: Sat May 30 23:39:16 2020 -0700
description: Add example code, rebuild docs.

diffstat:

 docs/0._This_Implementation_of_Joy_in_Python.rst                               |     78 +-
 docs/1._Basic_Use_of_Joy_in_a_Notebook.rst                                     |      4 +-
 docs/2._Library_Examples.rst                                                   |     44 +-
 docs/3._Developing_a_Program.rst                                               |    104 +-
 docs/Advent_of_Code_2017_December_1st.rst                                      |     72 +-
 docs/Advent_of_Code_2017_December_2nd.rst                                      |    230 +-
 docs/Advent_of_Code_2017_December_3rd.rst                                      |    228 +-
 docs/Advent_of_Code_2017_December_4th.rst                                      |     16 +-
 docs/Advent_of_Code_2017_December_5th.rst                                      |    170 +-
 docs/Advent_of_Code_2017_December_6th.rst                                      |     76 +-
 docs/Compiling_Joy.rst                                                         |     52 +-
 docs/Correcet_Programming.rst                                                  |    424 +-
 docs/Derivatives_of_Regular_Expressions.rst                                    |    286 +-
 docs/Generator_Programs.rst                                                    |    147 +-
 docs/Hylo-,_Ana-,_Cata-,_and_Para-morphisms_-_Recursion_Combinators.rst        |    464 +-
 docs/Makefile                                                                  |      2 +-
 docs/Newton-Raphson.rst                                                        |    114 +-
 docs/Ordered_Binary_Trees.rst                                                  |    866 +-
 docs/Quadratic.rst                                                             |     32 +-
 docs/Recursion_Combinators.rst                                                 |    334 +-
 docs/Replacing.rst                                                             |      8 +-
 docs/Square_Spiral.html                                                        |  13739 ++++++++++
 docs/Square_Spiral.ipynb                                                       |    554 +
 docs/Square_Spiral.md                                                          |    363 +
 docs/Square_Spiral.rst                                                         |    421 +
 docs/The_Four_Operations.rst                                                   |    208 +-
 docs/Trees.rst                                                                 |   1156 +-
 docs/Treestep.rst                                                              |    218 +-
 docs/TypeChecking.rst                                                          |      2 +-
 docs/Types.rst                                                                 |    632 +-
 docs/Zipper.rst                                                                |     53 +-
 docs/fun_with_scan.rst                                                         |    188 +-
 docs/notebook_preamble.py                                                      |      6 +-
 docs/sphinx_docs/_build/html/_modules/index.html                               |     73 +-
 docs/sphinx_docs/_build/html/_modules/joy/joy.html                             |     79 +-
 docs/sphinx_docs/_build/html/_modules/joy/library.html                         |     89 +-
 docs/sphinx_docs/_build/html/_modules/joy/parser.html                          |     73 +-
 docs/sphinx_docs/_build/html/_modules/joy/utils/pretty_print.html              |     85 +-
 docs/sphinx_docs/_build/html/_modules/joy/utils/stack.html                     |     71 +-
 docs/sphinx_docs/_build/html/_sources/index.rst.txt                            |     26 +
 docs/sphinx_docs/_build/html/_static/alabaster.css                             |    124 +-
 docs/sphinx_docs/_build/html/_static/basic.css                                 |    107 +-
 docs/sphinx_docs/_build/html/_static/doctools.js                               |     18 +-
 docs/sphinx_docs/_build/html/_static/documentation_options.js                  |      9 +-
 docs/sphinx_docs/_build/html/_static/jquery.js                                 |      6 +-
 docs/sphinx_docs/_build/html/_static/searchtools.js                            |    426 +-
 docs/sphinx_docs/_build/html/genindex.html                                     |    130 +-
 docs/sphinx_docs/_build/html/index.html                                        |    130 +-
 docs/sphinx_docs/_build/html/joy.html                                          |    169 +-
 docs/sphinx_docs/_build/html/lib.html                                          |    416 +-
 docs/sphinx_docs/_build/html/library.html                                      |    470 +-
 docs/sphinx_docs/_build/html/notebooks/Categorical.html                        |     97 +-
 docs/sphinx_docs/_build/html/notebooks/Derivatives_of_Regular_Expressions.html |    203 +-
 docs/sphinx_docs/_build/html/notebooks/Developing.html                         |    172 +-
 docs/sphinx_docs/_build/html/notebooks/Generator_Programs.html                 |    194 +-
 docs/sphinx_docs/_build/html/notebooks/Intro.html                              |    134 +-
 docs/sphinx_docs/_build/html/notebooks/Newton-Raphson.html                     |    146 +-
 docs/sphinx_docs/_build/html/notebooks/NoUpdates.html                          |    110 +-
 docs/sphinx_docs/_build/html/notebooks/Ordered_Binary_Trees.html               |    273 +-
 docs/sphinx_docs/_build/html/notebooks/Quadratic.html                          |    108 +-
 docs/sphinx_docs/_build/html/notebooks/Recursion_Combinators.html              |    230 +-
 docs/sphinx_docs/_build/html/notebooks/Replacing.html                          |    108 +-
 docs/sphinx_docs/_build/html/notebooks/The_Four_Operations.html                |    124 +-
 docs/sphinx_docs/_build/html/notebooks/Treestep.html                           |    160 +-
 docs/sphinx_docs/_build/html/notebooks/TypeChecking.html                       |    126 +-
 docs/sphinx_docs/_build/html/notebooks/Types.html                              |    486 +-
 docs/sphinx_docs/_build/html/notebooks/Zipper.html                             |    140 +-
 docs/sphinx_docs/_build/html/notebooks/index.html                              |    108 +-
 docs/sphinx_docs/_build/html/objects.inv                                       |    Bin 
 docs/sphinx_docs/_build/html/parser.html                                       |    114 +-
 docs/sphinx_docs/_build/html/pretty.html                                       |    150 +-
 docs/sphinx_docs/_build/html/py-modindex.html                                  |     69 +-
 docs/sphinx_docs/_build/html/search.html                                       |     80 +-
 docs/sphinx_docs/_build/html/searchindex.js                                    |      2 +-
 docs/sphinx_docs/_build/html/stack.html                                        |    247 +-
 docs/sphinx_docs/_build/html/types.html                                        |     80 +-
 docs/sphinx_docs/conf.py                                                       |      2 +-
 docs/sphinx_docs/index.rst                                                     |     26 +
 docs/sphinx_docs/notebooks/Derivatives_of_Regular_Expressions.rst              |    286 +-
 docs/sphinx_docs/notebooks/Generator_Programs.rst                              |    147 +-
 docs/sphinx_docs/notebooks/Newton-Raphson.rst                                  |    114 +-
 docs/sphinx_docs/notebooks/Ordered_Binary_Trees.rst                            |    866 +-
 docs/sphinx_docs/notebooks/Quadratic.rst                                       |     32 +-
 docs/sphinx_docs/notebooks/Recursion_Combinators.rst                           |    334 +-
 docs/sphinx_docs/notebooks/Replacing.rst                                       |      8 +-
 docs/sphinx_docs/notebooks/Square_Spiral.rst                                   |    421 +
 docs/sphinx_docs/notebooks/The_Four_Operations.rst                             |    208 +-
 docs/sphinx_docs/notebooks/Treestep.rst                                        |    218 +-
 docs/sphinx_docs/notebooks/TypeChecking.rst                                    |      2 +-
 docs/sphinx_docs/notebooks/Types.rst                                           |    632 +-
 docs/sphinx_docs/notebooks/Zipper.rst                                          |     53 +-
 docs/sphinx_docs/notebooks/index.rst                                           |      1 +
 docs/with_sympy.rst                                                            |    438 +-
 93 files changed, 23650 insertions(+), 7591 deletions(-)

diffs (truncated from 46700 to 300 lines):

diff -r 7e25e2e7ae17 -r 33cf8e5aec62 docs/0._This_Implementation_of_Joy_in_Python.rst
--- a/docs/0._This_Implementation_of_Joy_in_Python.rst	Tue May 19 14:50:10 2020 -0700
+++ b/docs/0._This_Implementation_of_Joy_in_Python.rst	Sat May 30 23:39:16 2020 -0700
@@ -22,18 +22,18 @@
 
 ::
 
-   $ python -m joy
-   Joypy - Copyright © 2017 Simon Forman
-   This program comes with ABSOLUTELY NO WARRANTY; for details type "warranty".
-   This is free software, and you are welcome to redistribute it
-   under certain conditions; type "sharing" for details.
-   Type "words" to see a list of all words, and "[<name>] help" to print the
-   docs for a word.
+    $ python -m joy
+    Joypy - Copyright © 2017 Simon Forman
+    This program comes with ABSOLUTELY NO WARRANTY; for details type "warranty".
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type "sharing" for details.
+    Type "words" to see a list of all words, and "[<name>] help" to print the
+    docs for a word.
 
 
-    <-top
+     <-top
 
-   joy? _
+    joy? _
 
 The ``<-top`` marker points to the top of the (initially empty) stack.
 You can enter Joy notation at the prompt and a `trace of
@@ -42,18 +42,18 @@
 
 ::
 
-   joy? 23 sqr 18 +
-          . 23 sqr 18 +
-       23 . sqr 18 +
-       23 . dup mul 18 +
-    23 23 . mul 18 +
-      529 . 18 +
-   529 18 . +
-      547 . 
+    joy? 23 sqr 18 +
+           . 23 sqr 18 +
+        23 . sqr 18 +
+        23 . dup mul 18 +
+     23 23 . mul 18 +
+       529 . 18 +
+    529 18 . +
+       547 . 
 
-   547 <-top
+    547 <-top
 
-   joy? 
+    joy? 
 
 Stacks (aka list, quote, sequence, etc.)
 ========================================
@@ -103,8 +103,8 @@
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Because Joy lists are made out of Python tuples they are immutable, so
-all Joy datastructures are `purely
-functional <https://en.wikipedia.org/wiki/Purely_functional_data_structure>`__.
+all Joy datastructures are *`purely
+functional <https://en.wikipedia.org/wiki/Purely_functional_data_structure>`__*.
 
 The ``joy()`` function.
 =======================
@@ -119,8 +119,8 @@
 
 Each function is passed the stack, expression, and dictionary and
 returns them. Whatever the function returns becomes the new stack,
-expression, and dictionary. (The dictionary is passed to enable
-e.g. writing words that let you enter new words into the dictionary at
+expression, and dictionary. (The dictionary is passed to enable e.g.
+writing words that let you enter new words into the dictionary at
 runtime, which nothing does yet and may be a bad idea, and the ``help``
 command.)
 
@@ -133,7 +133,7 @@
 View function
 ~~~~~~~~~~~~~
 
-The ``joy()`` function accepts a “viewer” function which it calls on
+The ``joy()`` function accepts a "viewer" function which it calls on
 each iteration passing the current stack and expression just before
 evaluation. This can be used for tracing, breakpoints, retrying after
 exceptions, or interrupting an evaluation and saving to disk or sending
@@ -147,7 +147,7 @@
 ``TracePrinter`` has a facility for printing out a trace of the
 evaluation, one line per step. Each step is aligned to the current
 interpreter position, signified by a period separating the stack on the
-left from the pending expression (“continuation”) on the right.
+left from the pending expression ("continuation") on the right.
 
 `Continuation-Passing Style <https://en.wikipedia.org/wiki/Continuation-passing_style>`__
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -191,7 +191,7 @@
 
 The parser is extremely simple, the undocumented ``re.Scanner`` class
 does most of the tokenizing work and then you just build the tuple
-structure out of the tokens. There’s no Abstract Syntax Tree or anything
+structure out of the tokens. There's no Abstract Syntax Tree or anything
 like that.
 
 .. code:: ipython2
@@ -226,7 +226,7 @@
     
 
 
-That’s pretty much all there is to it.
+That's pretty much all there is to it.
 
 .. code:: ipython2
 
@@ -298,7 +298,7 @@
 Library
 =======
 
-The Joy library of functions (aka commands, or “words” after Forth
+The Joy library of functions (aka commands, or "words" after Forth
 usage) encapsulates all the actual functionality (no pun intended) of
 the Joy system. There are simple functions such as addition ``add`` (or
 ``+``, the library module supports aliases), and combinators which
@@ -398,42 +398,42 @@
     
 
 
-Currently, there’s no function to add new definitions to the dictionary
-from “within” Joy code itself. Adding new definitions remains a
+Currently, there's no function to add new definitions to the dictionary
+from "within" Joy code itself. Adding new definitions remains a
 meta-interpreter action. You have to do it yourself, in Python, and wash
 your hands afterward.
 
 It would be simple enough to define one, but it would open the door to
 *name binding* and break the idea that all state is captured in the
-stack and expression. There’s an implicit *standard dictionary* that
+stack and expression. There's an implicit *standard dictionary* that
 defines the actual semantics of the syntactic stack and expression
 datastructures (which only contain symbols, not the actual functions.
 Pickle some and see for yourself.)
 
-“There should be only one.”
+"There should be only one."
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Which brings me to talking about one of my hopes and dreams for this
-notation: “There should be only one.” What I mean is that there should
+notation: "There should be only one." What I mean is that there should
 be one universal standard dictionary of commands, and all bespoke work
 done in a UI for purposes takes place by direct interaction and macros.
 There would be a *Grand Refactoring* biannually (two years, not six
-months, that’s semi-annually) where any new definitions factored out of
+months, that's semi-annually) where any new definitions factored out of
 the usage and macros of the previous time, along with new algorithms and
-such, were entered into the dictionary and posted to e.g. IPFS.
+such, were entered into the dictionary and posted to e.g. IPFS.
 
 Code should not burgeon wildly, as it does today. The variety of code
 should map more-or-less to the well-factored variety of human
-computably-solvable problems. There shouldn’t be dozens of chat apps, JS
-frameworks, programming languages. It’s a waste of time, a `fractal
-“thundering herd”
+computably-solvable problems. There shouldn't be dozens of chat apps, JS
+frameworks, programming languages. It's a waste of time, a `fractal
+"thundering herd"
 attack <https://en.wikipedia.org/wiki/Thundering_herd_problem>`__ on
 human mentality.
 
 Literary Code Library
 ^^^^^^^^^^^^^^^^^^^^^
 
-If you read over the other notebooks you’ll see that developing code in
+If you read over the other notebooks you'll see that developing code in
 Joy is a lot like doing simple mathematics, and the descriptions of the
 code resemble math papers. The code also works the first time, no bugs.
 If you have any experience programming at all, you are probably
diff -r 7e25e2e7ae17 -r 33cf8e5aec62 docs/1._Basic_Use_of_Joy_in_a_Notebook.rst
--- a/docs/1._Basic_Use_of_Joy_in_a_Notebook.rst	Tue May 19 14:50:10 2020 -0700
+++ b/docs/1._Basic_Use_of_Joy_in_a_Notebook.rst	Sat May 30 23:39:16 2020 -0700
@@ -58,7 +58,7 @@
 ``TracePrinter`` has a facility for printing out a trace of the
 evaluation, one line per step. Each step is aligned to the current
 interpreter position, signified by a period separating the stack on the
-left from the pending expression (“continuation”) on the right. I find
+left from the pending expression ("continuation") on the right. I find
 these traces beautiful, like a kind of art.
 
 .. code:: ipython2
@@ -105,7 +105,7 @@
                                    15 . 
 
 
-Here’s a longer trace.
+Here's a longer trace.
 
 .. code:: ipython2
 
diff -r 7e25e2e7ae17 -r 33cf8e5aec62 docs/2._Library_Examples.rst
--- a/docs/2._Library_Examples.rst	Tue May 19 14:50:10 2020 -0700
+++ b/docs/2._Library_Examples.rst	Sat May 30 23:39:16 2020 -0700
@@ -10,10 +10,10 @@
 
 This is what I like to call the functions that just rearrange things on
 the stack. (One thing I want to mention is that during a hypothetical
-compilation phase these “stack chatter” words effectively disappear,
+compilation phase these "stack chatter" words effectively disappear,
 because we can map the logical stack locations to registers that remain
 static for the duration of the computation. This remains to be done but
-it’s “off the shelf” technology.)
+it's "off the shelf" technology.)
 
 ``clear``
 ~~~~~~~~~
@@ -139,7 +139,7 @@
 ``roll<`` ``rolldown`` ``roll>`` ``rollup``
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-The “down” and “up” refer to the movement of two of the top three items
+The "down" and "up" refer to the movement of two of the top three items
 (displacing the third.)
 
 .. code:: ipython2
@@ -474,7 +474,7 @@
 ``swaack``
 ~~~~~~~~~~
 
-“Swap stack” swap the list on the top of the stack for the stack, and
+"Swap stack" swap the list on the top of the stack for the stack, and
 put the old stack on top of the new one. Think of it as a context
 switch. Niether of the lists/stacks change their order.
 
@@ -869,7 +869,7 @@
 ~~~~~~~~~~~~~~~~~~
 
 If we represent fractions as a quoted pair of integers [q d] this word
-reduces them to their … least common factors or whatever.
+reduces them to their ... least common factors or whatever.
 
 .. code:: ipython2
 
@@ -931,7 +931,7 @@
 
 ::
 
-   ? == dup truthy
+    ? == dup truthy
 
 .. code:: ipython2
 
@@ -1178,15 +1178,15 @@
 
 ::
 
-      n [P] [G] anamorphism
-   ---------------------------
-             [...]
+       n [P] [G] anamorphism
+    ---------------------------
+              [...]
 
 Example, ``range``:
 
 ::
 
-   range == [0 <=] [1 - dup] anamorphism
+    range == [0 <=] [1 - dup] anamorphism
 
 .. code:: ipython2
 
@@ -1226,25 +1226,25 @@
 
 ::
 
-   ... x [P] [Q] cleave
-
-From the original Joy docs: “The cleave combinator expects two
+    ... x [P] [Q] cleave
+
+From the original Joy docs: "The cleave combinator expects two
 quotations, and below that an item ``x`` It first executes ``[P]``, with
 ``x`` on top, and saves the top result element. Then it executes
 ``[Q]``, again with ``x``, and saves the top result. Finally it restores
 the stack to what it was below ``x`` and pushes the two results P(X) and
-Q(X).”
+Q(X)."
 
 Note that ``P`` and ``Q`` can use items from the stack freely, since the
 stack (below ``x``) is restored. ``cleave`` is a kind of *parallel*
-primitive, and it would make sense to create a version that uses,
-e.g. Python threads or something, to actually run ``P`` and ``Q``
+primitive, and it would make sense to create a version that uses, e.g.
+Python threads or something, to actually run ``P`` and ``Q``
 concurrently. The current implementation of ``cleave`` is a definition
 in terms of ``app2``:
 


More information about the Joypy-announce mailing list
Back to archive index