• R/O
  • HTTP
  • SSH
  • HTTPS

Thun: Repository summary

Interpreter and library.


Recent Commits RSS

Rev. Time Author Message
bca3986 2023-11-13 02:59:02 sforman master Better definition for enstacken.
f7c7dc2 2023-10-25 06:29:38 sforman Minor cleanup.
8f3a4f3 2023-10-25 01:49:42 sforman Minor cleanup.
961d841 2023-10-25 01:47:15 sforman Rearrange parser code. It fits on a page now and reads w...
4bb47c6 2023-10-24 14:50:57 sforman Fold in expect-right-bracket-lookahead
735ee73 2023-10-24 14:50:44 sforman Remake C version.
a6be85c 2023-10-24 08:06:35 sforman Remove underscores from example names. Just for visual e...
26725ce 2023-10-22 12:05:11 sforman Parse errors. Convert error to abort to get the messages...
0a135e0 2023-10-22 11:25:14 sforman Runtime type checking for bool. I think I'm going to ret...
bd55214 2023-10-22 11:13:59 sforman Runtime type checking for rest of core; inscribe.

Branches

Name Rev. Time Author Message
master bca3986 2023-11-13 02:59:02 sforman Better definition for ensta...
one_ref 8c6d3dc 2023-10-04 12:19:31 sforman Use slightly smaller font f...
vlist 7d99bb4 2023-02-19 13:09:19 Simon Forman SWIProlog
simpler 101a024 2023-02-10 00:52:50 Simon Forman and, or (Boolean ops). "no...

README.md

Thun

A Dialect of Joy.

Version 0.5.0

Simple pleasures are the best.

Joy is a programming language created by Manfred von Thun that is easy to use and understand and has many other nice properties. Thun is 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 written in C. It started as a Python project called "Joypy", but after someone claimed that name on PyPI before me I renamed it to Thun in honor of Manfred Von Thun. Now there are interpreters implemented in several additional languages (C, Elm, Nim, OCaml, Prolog, and Scheme).

Joy is:

The best source for learning about Joy is the information made available at the website of La Trobe University | (mirror) 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.

Example Code

Here is an example of Joy code. This function square_spiral accepts two integers 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 Square Spiral Example Joy Code.

square_spiral [p] [then] [else] ifte

p  [p0] [p1] and
p0 [abs] ii <=
p1 [<>] [pop !-] or

then [    !-] [[++]] [[--]] ifte dip
else [pop !-]  [--]   [++]  ifte

It might seem unreadable but with familiarity it becomes as legible as any other notation.

Project Hosted on SourceHut

Documentation

The Thun.md document describes the Thun dialect. Most of the rest of documentation is in the form of Jupyter Notebooks that go into more detail.

Jupyter Notebooks

I had a Joy kernel for the Jupyter Notebook system, but I can no longer figure out how to use it, so I'm rewriting the notebooks by hand.

There's also a Function Reference that lists each function and combinator by name and gives a brief description. (It's usually out of date, I'm working on it.)

Function Reference

There is more in the docs directory but it's kind of a mess right now (Aug 2023).

Directory structure

Thun
|-- LICENSE - GPLv3
|-- README.md - this file
|
|-- archive
|   |-- Joy-Programming.zip
|   `-- README
|
|-- docs
|   |-- dep-graphs - Generated dependency graphs.
|   |-- html - Generated HTML docs.
|   |-- notebooks - Jupyter Notebooks and supporting modules
|   `-- reference - Docs for each function.
|
|-- implementations
|   |-- defs.txt - common Joy definitions for all interpreters
|   |-- C - interpreter
|   |-- GNU Prolog - type inference
|   |-- Elm - interpreter
|   |-- Nim - interpreter
|   |-- Ocaml - work-in-progress interpreter
|   |-- Python - interpreter
|   |-- Scheme - interpreter
|   `-- SWI Prolog - interpreter
|                    type inference
|                    work-in-progress compiler
|
`-- joy_code - Source code written in Joy.
    `-- bigints
        `-- bigints.joy

Installation

Clone the repo:

git clone https://git.sr.ht/~sforman/Thun

Then follow the instructions in the individual implementations directories. In most cases you can just run make and that will build a binary called joy (in Python it's a script.)

There isn't really any installation as such. You can put the binaries in your PATH.


Copyright © 2014 - 2023 Simon Forman

This file is part of Thun

Show on old repository browser