Recover the square spiral example code.

I hve no idea how this isn't in VCS.  I checked hg and git.  Is it in
an old branch that I deleted before merging or something?  I have
backups from which to restore, but it would be nice to know how I effed
it up in the first place, eh?
This commit is contained in:
Simon Forman
2021-11-27 09:04:25 -08:00
parent f96013d649
commit 1b193b1924
63 changed files with 17476 additions and 1013 deletions
+25
View File
@@ -34,6 +34,31 @@ itself.
.. _Concatinative: https://en.wikipedia.org/wiki/Concatenative_programming_language
Example Code
--------------------------------------------------
Here is an example of Joy code::
[[[abs]ii <=][[<>][pop !-]||]&&][[!-][[++]][[--]]ifte dip][[pop !-][--][++]ifte]ifte
It might seem unreadable but with a little familiarity it becomes just as
legible as any other notation. Some layout helps::
[ [[abs] ii <=]
[
[<>] [pop !-] ||
] &&
]
[[ !-] [[++]] [[--]] ifte dip]
[[pop !-] [--] [++] ifte ]
ifte
This function accepts two integers on the stack and increments or
decrements one of them such that the new pair of numbers is the next
coordinate pair in a square spiral (like the kind used to construct an
Ulam Spiral). For more information see :doc:`notebooks/Square_Spiral`
Quick Start
--------------------------------------------------