OSDN Git Service

Bleah.
[joypy/Thun.git] / docs / sphinx_docs / _build / html / notebooks / Categorical.html
1
2 <!DOCTYPE html>
3
4 <html>
5   <head>
6     <meta charset="utf-8" />
7     <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
8
9     <title>Categorical Programming &#8212; Thun 0.4.1 documentation</title>
10     <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
11     <link rel="stylesheet" type="text/css" href="../_static/alabaster.css" />
12     <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
13     <script src="../_static/jquery.js"></script>
14     <script src="../_static/underscore.js"></script>
15     <script src="../_static/doctools.js"></script>
16     <link rel="index" title="Index" href="../genindex.html" />
17     <link rel="search" title="Search" href="../search.html" />
18     <link rel="next" title="The Four Fundamental Operations of Definite Action" href="The_Four_Operations.html" />
19     <link rel="prev" title="No Updates" href="NoUpdates.html" />
20    
21   <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
22   
23   
24   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
25
26   </head><body>
27   
28
29     <div class="document">
30       <div class="documentwrapper">
31         <div class="bodywrapper">
32           
33
34           <div class="body" role="main">
35             
36   <section id="categorical-programming">
37 <h1>Categorical Programming<a class="headerlink" href="#categorical-programming" title="Permalink to this headline">¶</a></h1>
38 <p>DRAFT</p>
39 <p><a class="reference external" href="https://en.wikipedia.org/wiki/Category_theory">Categorical</a></p>
40 <p>In Manfred von Thun’s article <a class="reference external" href="http://www.kevinalbrecht.com/code/joy-mirror/j08cnt.html">Joy compared with other functional languages</a> he asks, “Could the language of categories be used for writing programs? Any lambda expression can be translated into a categorical expression, so the language of categories is expressively complete. But this does not make it a suitable language for writing programs. As it stands it is a very low-level language.”</p>
41 <p>In <a class="reference external" href="http://conal.net/papers/compiling-to-categories/">Compiling to categories</a> Conal Elliott give a taste of what this might mean.</p>
42 <blockquote>
43 <div><p>It is well-known that the simply typed lambda-calculus is modeled by any cartesian closed category (CCC). This correspondence suggests giving typed functional programs a variety of interpretations, each corresponding to a different category. A convenient way to realize this idea is as a collection of meaning-preserving transformations added to an existing compiler, such as GHC for Haskell. This paper describes such an implementation and demonstrates its use for a variety of interpretations including hardware circuits, automatic differentiation, incremental computation, and interval analysis. Each such interpretation is a category easily defined in Haskell (outside of the compiler). The general technique appears to provide a compelling alternative to deeply embedded domain-specific languages.</p>
44 </div></blockquote>
45 <p>What he’s doing is translating lambda forms into a kind of “point-free” style that is very close to Joy code (although more verbose) and then showing how to instantiate that code over different categories to get several different kinds of program out of the same code.</p>
46 </section>
47
48
49           </div>
50           
51         </div>
52       </div>
53       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
54         <div class="sphinxsidebarwrapper">
55 <h1 class="logo"><a href="../index.html">Thun</a></h1>
56
57
58
59
60
61
62
63
64 <h3>Navigation</h3>
65 <ul class="current">
66 <li class="toctree-l1"><a class="reference internal" href="Intro.html">Thun: Joy in Python</a></li>
67 <li class="toctree-l1"><a class="reference internal" href="../joy.html">Joy Interpreter</a></li>
68 <li class="toctree-l1"><a class="reference internal" href="../stack.html">Stack or Quote or Sequence or List…</a></li>
69 <li class="toctree-l1"><a class="reference internal" href="../parser.html">Parsing Text into Joy Expressions</a></li>
70 <li class="toctree-l1"><a class="reference internal" href="../pretty.html">Tracing Joy Execution</a></li>
71 <li class="toctree-l1"><a class="reference internal" href="../library.html">Function Reference</a></li>
72 <li class="toctree-l1"><a class="reference internal" href="../lib.html">Functions Grouped by, er, Function with Examples</a></li>
73 <li class="toctree-l1"><a class="reference internal" href="../types.html">Type Inference of Joy Expressions</a></li>
74 <li class="toctree-l1 current"><a class="reference internal" href="index.html">Essays about Programming in Joy</a><ul class="current">
75 <li class="toctree-l2"><a class="reference internal" href="Developing.html">Developing a Program in Joy</a></li>
76 <li class="toctree-l2"><a class="reference internal" href="Quadratic.html">Quadratic formula</a></li>
77 <li class="toctree-l2"><a class="reference internal" href="Replacing.html">Replacing Functions in the Dictionary</a></li>
78 <li class="toctree-l2"><a class="reference internal" href="Recursion_Combinators.html">Recursion Combinators</a></li>
79 <li class="toctree-l2"><a class="reference internal" href="Ordered_Binary_Trees.html">Treating Trees I: Ordered Binary Trees</a></li>
80 <li class="toctree-l2"><a class="reference internal" href="Treestep.html">Treating Trees II: <code class="docutils literal notranslate"><span class="pre">treestep</span></code></a></li>
81 <li class="toctree-l2"><a class="reference internal" href="Generator_Programs.html">Using <code class="docutils literal notranslate"><span class="pre">x</span></code> to Generate Values</a></li>
82 <li class="toctree-l2"><a class="reference internal" href="Newton-Raphson.html">Newton’s method</a></li>
83 <li class="toctree-l2"><a class="reference internal" href="Zipper.html">Traversing Datastructures with Zippers</a></li>
84 <li class="toctree-l2"><a class="reference internal" href="Types.html">The Blissful Elegance of Typing Joy</a></li>
85 <li class="toctree-l2"><a class="reference internal" href="TypeChecking.html">Type Checking</a></li>
86 <li class="toctree-l2"><a class="reference internal" href="NoUpdates.html">No Updates</a></li>
87 <li class="toctree-l2 current"><a class="current reference internal" href="#">Categorical Programming</a></li>
88 <li class="toctree-l2"><a class="reference internal" href="The_Four_Operations.html">The Four Fundamental Operations of Definite Action</a></li>
89 <li class="toctree-l2"><a class="reference internal" href="Derivatives_of_Regular_Expressions.html">∂RE</a></li>
90 </ul>
91 </li>
92 </ul>
93
94 <div class="relations">
95 <h3>Related Topics</h3>
96 <ul>
97   <li><a href="../index.html">Documentation overview</a><ul>
98   <li><a href="index.html">Essays about Programming in Joy</a><ul>
99       <li>Previous: <a href="NoUpdates.html" title="previous chapter">No Updates</a></li>
100       <li>Next: <a href="The_Four_Operations.html" title="next chapter">The Four Fundamental Operations of Definite Action</a></li>
101   </ul></li>
102   </ul></li>
103 </ul>
104 </div>
105 <div id="searchbox" style="display: none" role="search">
106   <h3 id="searchlabel">Quick search</h3>
107     <div class="searchformwrapper">
108     <form class="search" action="../search.html" method="get">
109       <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
110       <input type="submit" value="Go" />
111     </form>
112     </div>
113 </div>
114 <script>$('#searchbox').show(0);</script>
115
116
117
118
119
120
121
122
123         </div>
124       </div>
125       <div class="clearer"></div>
126     </div>
127     <div class="footer" role="contentinfo">
128 <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
129 <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" />
130 </a>
131 <br />
132 <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>.
133       Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.3.0.
134     </div>
135
136   </body>
137 </html>