Enlist
A Jelly-like language whose chains follow rules of their own and whose numbers are exact fractions.
HyperNeutrino · Turing complete: unknown · ●●● hard
Tested with 7 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
Enlist is a golfing language by HyperNeutrino, in the repository alexander-liao/enlist. Its README says it is largely inspired by Jelly and aims to be short for numbers and lists. As in Jelly, a program is a chain of atoms with no variables and no stack. Each atom is a nilad, a monad or a dyad, and the chain decides where each value goes by the pattern of those kinds.
Read the story
The interpreter is a Python file of its own, not a copy of Jelly's, and its chain rules differ. This implementation follows that source. Numbers are SymPy numbers, so 7÷2 is the fraction 7/2 and prints as 7/2.
The machine
The arguments become the inputs of the chain. With none the chain is niladic, with one monadic, with two dyadic. In this implementation each line of input is one argument, read the way Python's eval reads it, so [1,2,3] is a list and abc becomes the list of its characters.
| Atom | Does |
|---|---|
“…” ”c | A list of characters, one character |
5 - 1.5 | 5, minus one, the fraction 3/2 |
+ _ × ÷ : % | Arithmetic, mapped over lists |
R Ḷ | The list 1 to n, 0 to n−1 |
S P L | Sum, product, length |
‘ ’ | Take one, add one |
D H | Decimal and hexadecimal digits |
, ; | Pair, join |
A monadic chain keeps one value. A dyad followed by a nilad applies the dyad to the value and the nilad; a dyad alone uses the argument as its right side; a monad applies to the value. The result is printed with lists of characters joined into text and other lists in Python's form.
Example
R turns the argument 10 into the list 1 to 10 and S sums it.
R turns the argument 10 into the list 1 to 10 and S sums it.
In the last one a nilad comes after a value, so the value so far is printed without a newline and the chain goes on with the new one.
This implementation is a subset. It has 24 atoms and the chain rules. The quicks, the other atoms and the other kinds of string stop the run with a reason.
Patterns it teaches
- Code golf: the kinds of atoms in a row decide the data flow, so no byte is spent on naming a value.
Try this
- Print the squares of 1 to 10.
- Sum the digits of the input.
- Hard: print the average of a list given as input.
Further
- The reference interpreter, in Python
- Related: Jelly, Anyfix
See also
Also in Golfing
Write your own in Run Convert a program from Enlist
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: enlist.
Command line
shib run enlist -e '+' --input '3
4'shib manual enlistSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/enlist.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language