OSDN Git Service

Rename BigNums.
[joypy/Thun.git] / README.md
1 # Thun
2
3 A Dialect of Joy.
4
5 Version 0.5.0
6
7 > Simple pleasures are the best.
8
9 [Joy](https://en.wikipedia.org/wiki/Joy_%28programming_language%29) is a
10 programming language created by Manfred von Thun that is easy to use and
11 understand and has many other nice properties.  **Thun** is a dialect of
12 Joy that attempts to stay very close to the spirit of Joy but does not
13 precisely match the behaviour of the original version written in C.  It
14 started as a Python project called "Joypy", but after someone claimed
15 that name on PyPI before me I renamed it to Thun in honor of Manfred Von
16 Thun. Now there are interpreters implemented in several additional
17 languages (C, Elm, Nim, OCaml, Prolog, and Scheme).
18
19 Joy is:
20
21 * [Purely Functional](https://en.wikipedia.org/wiki/Purely_functional_programming)
22 * [Stack-based](https://en.wikipedia.org/wiki/Stack-oriented_programming_language)
23 * [Concatinative](https://en.wikipedia.org/wiki/Concatenative_programming_language)
24   (See also [concatenative.org](http://www.concatenative.org/wiki/view/Concatenative%20language))
25 * [Categorical](https://joypy.osdn.io/notebooks/Categorical.html)
26
27 The best source for learning about Joy is the information made available
28 at the [website of La Trobe University](http://www.latrobe.edu.au/humanities/research/research-projects/past-projects/joy-programming-language)
29 | [(mirror)](https://www.kevinalbrecht.com/code/joy-mirror/) which
30 contains source code for the original C interpreter, Joy language source
31 code for various functions, and a great deal of fascinating material
32 mostly written by Von Thun on Joy and its deeper facets as well as how to
33 program in it and several interesting aspects.  It's quite a treasure
34 trove.
35
36 * [Wikipedia entry for Joy](https://en.wikipedia.org/wiki/Joy_%28programming_language%29)
37 * [Homepage at La Trobe University](http://www.latrobe.edu.au/humanities/research/research-projects/past-projects/joy-programming-language)
38   [(Kevin Albrecht's mirror)](https://www.kevinalbrecht.com/code/joy-mirror/)
39 * [The original Thun/Joypy site](https://web.archive.org/web/20220411010035/https://joypy.osdn.io/)
40
41
42 ## Example Code
43
44 Here is an example of Joy code.  This function `square_spiral` accepts
45 two integers and increments or decrements one of them such that the new
46 pair of numbers is the next coordinate pair in a square spiral (like the
47 kind used to construct an [Ulam Spiral](https://en.wikipedia.org/wiki/Ulam_spiral)).
48 For more information see [Square Spiral Example Joy Code](https://joypy.osdn.io/notebooks/Square_Spiral.html).
49
50     square_spiral [_p] [_then] [_else] ifte
51
52     _p  [_p0] [_p1] and
53     _p0 [abs] ii <=
54     _p1 [<>] [pop !-] or
55
56     _then [    !-] [[++]] [[--]] ifte dip
57     _else [pop !-]  [--]   [++]  ifte
58
59 It might seem unreadable but with familiarity it becomes as legible as
60 any other notation.
61
62
63 ## Project Hosted on [SourceHut](https://git.sr.ht/~sforman/Thun)
64
65 * [Source Repository](https://git.sr.ht/~sforman/Thun)
66   ([mirror](https://github.com/calroc/Thun))
67 * [Bug tracker](https://todo.sr.ht/~sforman/thun-der)
68   ([old tracker](https://osdn.net/projects/joypy/ticket/))
69 * [Forums](https://osdn.net/projects/joypy/forums/)
70 * [Mailing list](https://osdn.net/projects/joypy/lists/)
71
72
73 ## Documentation
74
75 The `Thun.md` document describes the Thun dialect. Most of the rest of
76 documentation is in the form of
77 [Jupyter Notebooks](https://joypy.osdn.io/notebooks/index.html)
78 that go into more detail.
79
80 **[Jupyter Notebooks](https://joypy.osdn.io/notebooks/index.html)**
81
82 I had a Joy kernel for the Jupyter Notebook system, but I can no longer
83 figure out how to use it, so I'm rewriting the notebooks by hand.
84
85 There's also a [Function Reference](https://git.sr.ht/~sforman/Thun/tree/trunk/item/docs/reference) that lists each
86 function and combinator by name and gives a brief description.  (It's
87 usually out of date, I'm working on it.)
88
89 **[Function Reference](https://git.sr.ht/~sforman/Thun/tree/trunk/item/docs/reference)**
90
91 There is more in the `docs` directory but it's kind of a mess right now
92 (Aug 2023).
93
94
95 ## Directory structure
96
97     Thun
98     |-- LICENSE - GPLv3
99     |-- README.md - this file
100     |
101     |-- archive
102     |   |-- Joy-Programming.zip
103     |   `-- README
104     |
105     |-- docs
106     |   |-- dep-graphs - Generated dependency graphs.
107     |   |-- html - Generated HTML docs.
108     |   |-- notebooks - Jupyter Notebooks and supporting modules
109     |   `-- reference - Docs for each function.
110     |
111     |-- implementations
112     |   |-- defs.txt - common Joy definitions for all interpreters
113     |   |-- C - interpreter
114     |   |-- GNU Prolog - type inference
115     |   |-- Elm - interpreter
116     |   |-- Nim - interpreter
117     |   |-- Ocaml - work-in-progress interpreter
118     |   |-- Python - interpreter
119     |   |-- Scheme - interpreter
120     |   `-- SWI Prolog - interpreter
121     |                    type inference
122     |                    work-in-progress compiler
123     |
124     `-- joy_code - Source code written in Joy.
125         `-- bigints
126             `-- bigints.joy
127
128
129 ## Installation
130
131 Clone the repo:
132
133     git clone https://git.sr.ht/~sforman/Thun
134
135 Then follow the instructions in the individual `implementations`
136 directories.  In most cases you can just run `make` and that will build a
137 binary called `joy` (in Python it's a script.)
138
139 There isn't really any installation as such. You can put the binaries in
140 your ``PATH``.
141
142
143
144
145
146
147
148 --------------------------------------------------
149
150 Copyright © 2014 - 2023 Simon Forman
151
152 This file is part of Thun
153