Parenthetic
A Lisp in which even the names are made of parentheses.
Cam McKinnon, 2012 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 5 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
Cam McKinnon made Parenthetic in 2012. It is a small Lisp with define, lambda, if, arithmetic and pairs, but its source may only use ( and ). Every other character is a comment.
Read the story
So names have to be spelled in brackets too. (()X) is the symbol whose name is the bracket text X, and ((())X) is a number, the count of ( in X. Anything else is a call.
The machine
| Name | Spelled | Does |
|---|---|---|
| lambda, define | () ()() | Make a function; bind a name |
| plus, minus | (()) (()()) | Numbers; plus also joins strings and pairs |
| multiply, divide | ()(()) (())() | On floats |
| equal, <=, not, if | (())(()) ()(())() ()(()()) ()()() | Tests give True or False |
| cons, car, cdr, empty | ((()))() ((()))(()) ((()))()() ((())) | Pairs and lists |
| char, string | (())(())() (())()(()) | A character code; a list of characters as a string |
Each top-level expression is printed on its own line the way Python 2 prints a value, so 9 shows as 9.0. A function sees the variables of whoever calls it, not of where it was written. Any mistake at all prints Parenthesis Mismatch and stops.
Example
The first is (plus 3 6).
The first is (plus 3 6). The second builds the list of 1 and 2. The third defines a factorial whose name is spelled ()()()() and whose argument is (((()))), then calls it on 6.
Further
Ideas it shows
See also
Functional paradigm
Write your own in Run Convert a program from Parenthetic
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: parenthetic.
Command line
shib run parenthetic -e '(()'shib manual parentheticSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/parenthetic.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org