minor edits
This commit is contained in:
parent
b3a0bac5a7
commit
5b8a430d1d
40
README.md
40
README.md
|
|
@ -14,7 +14,7 @@ precisely match the behaviour of the original version written in C. It
|
||||||
started as a Python project called "Joypy", but after someone claimed that
|
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.
|
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
|
Now there are interpreters implemented in several additional languages
|
||||||
(C, Nim, Prolog, Rust).
|
(C, Elm, Nim, OCaml, Prolog, Rust).
|
||||||
|
|
||||||
Joy is:
|
Joy is:
|
||||||
|
|
||||||
|
|
@ -49,9 +49,9 @@ For more information see [Square Spiral Example Joy Code](https://joypy.osdn.io/
|
||||||
|
|
||||||
square_spiral [_p] [_then] [_else] ifte
|
square_spiral [_p] [_then] [_else] ifte
|
||||||
|
|
||||||
_p [_p0] [_p1] &&
|
_p [_p0] [_p1] and
|
||||||
_p0 [abs] ii <=
|
_p0 [abs] ii <=
|
||||||
_p1 [<>] [pop !-] ||
|
_p1 [<>] [pop !-] or
|
||||||
|
|
||||||
_then [ !-] [[++]] [[--]] ifte dip
|
_then [ !-] [[++]] [[--]] ifte dip
|
||||||
_else [pop !-] [--] [++] ifte
|
_else [pop !-] [--] [++] ifte
|
||||||
|
|
@ -126,18 +126,14 @@ that. Really you need to run (GNU) make in the `docs/notebooks` and
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Clone the repo and follow the instructions in the individual
|
Clone the repo:
|
||||||
`implementations` directories. There isn't really any installation. You
|
|
||||||
can put the binaries in your ``PATH``.
|
|
||||||
|
|
||||||
(I had the Python package set up to upload to PyPI as "Thun", but the
|
git clone https://git.sr.ht/~sforman/Thun
|
||||||
whole Python distribution story seems unsettled at the moment (2023) so
|
|
||||||
I've gone back to the *old ways*: there is a single script ``joy.py``
|
Then follow the instructions in the individual `implementations` directories.
|
||||||
that gets modified (``defs.txt`` is inserted) to create a ``joy`` script
|
|
||||||
that uses the "shebang" trick to pretend to be a binary. In other words,
|
(There isn't really any installation as such.
|
||||||
run ``make`` and put the resulting ``joy`` script in your PATH, if that's
|
You can put the binaries in your ``PATH``.)
|
||||||
what you want to do. In a year or two the Python folks will have sorted
|
|
||||||
things out and we can go back to ``pip install Thun`` or whatever.)
|
|
||||||
|
|
||||||
|
|
||||||
## Basics of Joy
|
## Basics of Joy
|
||||||
|
|
@ -271,12 +267,15 @@ They could be grouped:
|
||||||
- Math (`+ - * / %`)
|
- Math (`+ - * / %`)
|
||||||
- Comparison (`< > >= <= != <> =`)
|
- Comparison (`< > >= <= != <> =`)
|
||||||
- Logic (`truthy not`)
|
- Logic (`truthy not`)
|
||||||
|
- Programming (`inscribe`)
|
||||||
|
|
||||||
Many of these could be definitions, but we don't want to be completely minimal at the cost of efficiency, eh?
|
Some of these could be definitions, but we don't want to be completely
|
||||||
|
minimal at the cost of efficiency, eh?
|
||||||
|
|
||||||
rest == [pop] infra
|
rest == [pop] infra
|
||||||
|
|
||||||
Also, custom error messages are nice? (E.g. `rest` has a distinct error from `pop`, at least in the current design.)
|
Also, custom error messages are nice? (E.g. `rest` has a distinct error
|
||||||
|
from `pop`, at least in the current design.)
|
||||||
|
|
||||||
|
|
||||||
### AND, OR, XOR, NOT
|
### AND, OR, XOR, NOT
|
||||||
|
|
@ -285,11 +284,10 @@ There are three families (categories?) of these operations:
|
||||||
|
|
||||||
1. Logical ops that take and return Boolean values.
|
1. Logical ops that take and return Boolean values.
|
||||||
2. Bitwise ops that treat integers as bit-strings.
|
2. Bitwise ops that treat integers as bit-strings.
|
||||||
3. Short-Circuiting Combinators that accept a Boolean and a quoted program
|
3. Short-Circuiting Combinators that accept two quoted programs
|
||||||
and run the quote *iff* the Boolean doesn't suffice to resolve the clause.
|
and run top quote *iff* the second doesn't suffice to resolve the clause.
|
||||||
(in other words `true [P] and` runs `P` whereas `false [P] and` discards
|
(in other words `[A] [B] and` runs `B` only if `A` evaluates to `true`,
|
||||||
it and leaves `false` on the stack, and similarly for `or` but with the
|
and similarly for `or` but only if `A` evaluates to `false`.)
|
||||||
logical polarity, if you will, reversed.)
|
|
||||||
|
|
||||||
(So far, only the Elm interpreter implements the bitwise ops. The others
|
(So far, only the Elm interpreter implements the bitwise ops. The others
|
||||||
two kinds of ops are defined in the `defs.txt` file, but you could implement
|
two kinds of ops are defined in the `defs.txt` file, but you could implement
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue