263 lines
17 KiB
HTML
263 lines
17 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>Thun 0.4.1 Documentation — Thun 0.4.1 documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||
<script src="_static/jquery.js"></script>
|
||
<script src="_static/underscore.js"></script>
|
||
<script src="_static/doctools.js"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="Thun: Joy in Python" href="notebooks/Intro.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<section id="thun-release-documentation">
|
||
<h1>Thun 0.4.1 Documentation<a class="headerlink" href="#thun-release-documentation" title="Permalink to this headline">¶</a></h1>
|
||
<p>Thun is dialect of Joy written in Python.</p>
|
||
<p><a class="reference external" href="https://en.wikipedia.org/wiki/Joy_(programming_language)">Joy</a> is a programming language created by Manfred von Thun that is easy to
|
||
use and understand and has many other nice properties. This Python
|
||
package implements an interpreter for a dialect of Joy that attempts to
|
||
stay very close to the spirit of Joy but does not precisely match the
|
||
behaviour of the original version(s) written in C. The main difference
|
||
between Thun and the originals, other than being written in Python, is
|
||
that it works by the “Continuation-Passing Style”.</p>
|
||
<p>Joy is:</p>
|
||
<ul class="simple">
|
||
<li><p><a class="reference external" href="https://en.wikipedia.org/wiki/Purely_functional_programming">Purely Functional</a></p></li>
|
||
<li><p><a class="reference external" href="https://en.wikipedia.org/wiki/Stack-oriented_programming_language">Stack-based</a></p></li>
|
||
<li><p><a class="reference external" href="https://en.wikipedia.org/wiki/Concatenative_programming_language">Concatinative</a> ( See also <a class="reference external" href="http://www.concatenative.org/wiki/view/Concatenative%20language">concatenative.org</a>)</p></li>
|
||
<li><p><a class="reference internal" href="notebooks/Categorical.html"><span class="doc">Categorical</span></a></p></li>
|
||
</ul>
|
||
<p>I hope that this package is useful in the sense that it provides an
|
||
additional joy interpreter (the binary in the archive from La Trobe seems
|
||
to run just fine on my modern Linux machine!) But I also hope that you
|
||
can read and understand the Python code and play with the implementation
|
||
itself.</p>
|
||
<section id="example-code">
|
||
<h2>Example Code<a class="headerlink" href="#example-code" title="Permalink to this headline">¶</a></h2>
|
||
<p>Here is an example of Joy code:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>[[[abs]ii <=][[<>][pop !-]||]&&][[!-][[++]][[--]]ifte dip][[pop !-][--][++]ifte]ifte
|
||
</pre></div>
|
||
</div>
|
||
<p>It might seem unreadable but with a little familiarity it becomes just as
|
||
legible as any other notation. Some layout helps:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>[ [[abs] ii <=]
|
||
[
|
||
[<>] [pop !-] ||
|
||
] &&
|
||
]
|
||
[[ !-] [[++]] [[--]] ifte dip]
|
||
[[pop !-] [--] [++] ifte ]
|
||
ifte
|
||
</pre></div>
|
||
</div>
|
||
<p>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
|
||
<a class="reference external" href="https://en.wikipedia.org/wiki/Ulam_spiral">Ulam Spiral</a>). For more information see <a class="reference internal" href="notebooks/Square_Spiral.html"><span class="doc">Square Spiral Example Joy Code</span></a></p>
|
||
</section>
|
||
<section id="quick-start">
|
||
<h2>Quick Start<a class="headerlink" href="#quick-start" title="Permalink to this headline">¶</a></h2>
|
||
<p>Install from <a class="reference external" href="https://pypi.org/project/Thun/">PyPI</a> in the usual way:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ pip install Thun
|
||
</pre></div>
|
||
</div>
|
||
<p>To start the REPL:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python -m joy
|
||
</pre></div>
|
||
</div>
|
||
<p>Continue with <a class="reference internal" href="notebooks/Intro.html"><span class="doc">the introduction</span></a>.</p>
|
||
</section>
|
||
<section id="project-hosted-on-osdn">
|
||
<h2>Project Hosted on <a class="reference external" href="https://osdn.net/projects/joypy/">OSDN</a><a class="headerlink" href="#project-hosted-on-osdn" title="Permalink to this headline">¶</a></h2>
|
||
<ul class="simple">
|
||
<li><p><a class="reference external" href="https://osdn.net/projects/joypy/scm/git/Thun/">Source Repository</a> (<a class="reference external" href="https://github.com/calroc/Thun">mirror</a>)</p></li>
|
||
<li><p><a class="reference external" href="https://todo.sr.ht/~sforman/thun-der">Bug tracker</a> (<a class="reference external" href="https://osdn.net/projects/joypy/ticket/">old tracker</a>)</p></li>
|
||
<li><p><a class="reference external" href="https://osdn.net/projects/joypy/forums/">Forums</a></p></li>
|
||
<li><p><a class="reference external" href="https://osdn.net/projects/joypy/lists/">Mailing list</a></p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="information-on-the-joy-language">
|
||
<h2>Information on the Joy language<a class="headerlink" href="#information-on-the-joy-language" title="Permalink to this headline">¶</a></h2>
|
||
<p>See <a class="reference external" href="https://en.wikipedia.org/wiki/Joy_(programming_language)">the Wikipedia article</a> and <a class="reference external" href="http://www.kevinalbrecht.com/code/joy-mirror/index.html">Kevin Albrecht’s mirror of Manfred von Thun’s original website for the Joy Programming Language</a> for more information on the Joy language.</p>
|
||
<p>The best source (no pun intended) for learning about Joy is the
|
||
information made available at the website of La Trobe University (see the
|
||
mirror link above) which contains source code for the
|
||
original C interpreter, Joy language source code for various functions,
|
||
and a great deal of fascinating material mostly written by Von Thun on
|
||
Joy and its deeper facets as well as how to program in it and several
|
||
interesting aspects. It’s quite a treasure trove.</p>
|
||
</section>
|
||
<section id="documentation-on-thun-dialect">
|
||
<h2>Documentation on Thun Dialect<a class="headerlink" href="#documentation-on-thun-dialect" title="Permalink to this headline">¶</a></h2>
|
||
<p>The following is specific information for this dialect of Joy.</p>
|
||
<div class="toctree-wrapper compound">
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="notebooks/Intro.html">Thun: Joy in Python</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Intro.html#read-eval-print-loop-repl">Read-Eval-Print Loop (REPL)</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Intro.html#the-stack">The Stack</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Intro.html#purely-functional-datastructures">Purely Functional Datastructures</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Intro.html#the-joy-function">The <code class="docutils literal notranslate"><span class="pre">joy()</span></code> function</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Intro.html#parser">Parser</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Intro.html#library">Library</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="joy.html">Joy Interpreter</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="joy.html#module-joy.joy"><code class="docutils literal notranslate"><span class="pre">joy.joy</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="stack.html">Stack or Quote or Sequence or List…</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="stack.html#module-joy.utils.stack"><code class="docutils literal notranslate"><span class="pre">joy.utils.stack</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="parser.html">Parsing Text into Joy Expressions</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="parser.html#module-joy.parser"><code class="docutils literal notranslate"><span class="pre">joy.parser</span></code></a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="parser.html#parser-internals">Parser Internals</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="pretty.html">Tracing Joy Execution</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="pretty.html#module-joy.utils.pretty_print"><code class="docutils literal notranslate"><span class="pre">joy.utils.pretty_print</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="library.html">Function Reference</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="library.html#module-joy.library"><code class="docutils literal notranslate"><span class="pre">joy.library</span></code></a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="library.html#module-joy.utils.generated_library">Auto-generated Functions</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="lib.html">Functions Grouped by, er, Function with Examples</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#stack-chatter">Stack Chatter</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#list-words">List words</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#math-words">Math words</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#logic-and-comparison">Logic and Comparison</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#miscellaneous">Miscellaneous</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#combinators">Combinators</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="lib.html#void"><code class="docutils literal notranslate"><span class="pre">void</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="types.html">Type Inference of Joy Expressions</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="types.html#joy-utils-types"><code class="docutils literal notranslate"><span class="pre">joy.utils.types</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="notebooks/index.html">Essays about Programming in Joy</a><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Developing.html">Developing a Program in Joy</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Quadratic.html">Quadratic formula</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Replacing.html">Replacing Functions in the Dictionary</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Recursion_Combinators.html">Recursion Combinators</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Ordered_Binary_Trees.html">Treating Trees I: Ordered Binary Trees</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Treestep.html">Treating Trees II: <code class="docutils literal notranslate"><span class="pre">treestep</span></code></a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Generator_Programs.html">Using <code class="docutils literal notranslate"><span class="pre">x</span></code> to Generate Values</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Newton-Raphson.html">Newton’s method</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Square_Spiral.html">Square Spiral Example Joy Code</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Zipper.html">Traversing Datastructures with Zippers</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Types.html">The Blissful Elegance of Typing Joy</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/TypeChecking.html">Type Checking</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/NoUpdates.html">No Updates</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Categorical.html">Categorical Programming</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/The_Four_Operations.html">The Four Fundamental Operations of Definite Action</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="notebooks/Derivatives_of_Regular_Expressions.html">∂RE</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<section id="indices-and-tables">
|
||
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
|
||
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
|
||
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
|
||
</ul>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h1 class="logo"><a href="#">Thun</a></h1>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="toctree-l1"><a class="reference internal" href="notebooks/Intro.html">Thun: Joy in Python</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="joy.html">Joy Interpreter</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="stack.html">Stack or Quote or Sequence or List…</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="parser.html">Parsing Text into Joy Expressions</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="pretty.html">Tracing Joy Execution</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="library.html">Function Reference</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="lib.html">Functions Grouped by, er, Function with Examples</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="types.html">Type Inference of Joy Expressions</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="notebooks/index.html">Essays about Programming in Joy</a></li>
|
||
</ul>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="#">Documentation overview</a><ul>
|
||
<li>Next: <a href="notebooks/Intro.html" title="next chapter">Thun: Joy in Python</a></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
|
||
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" />
|
||
</a>
|
||
<br />
|
||
<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Thun Documentation</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://joypy.osdn.io/" property="cc:attributionName" rel="cc:attributionURL">Simon Forman</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="https://osdn.net/projects/joypy/" rel="dct:source">https://osdn.net/projects/joypy/</a>.
|
||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.4.0.
|
||
</div>
|
||
|
||
</body>
|
||
</html> |