Functional deadfish~
Deadfish~ with a shelf of functions, and the accumulator says which shelf.
Turing complete: no · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Functional deadfish~ joins two variations of Deadfish. From Deadfish~ it takes printing characters, the tenfold repeat {..} and the skip (..). From Functional deadfish it takes functions. A function has no name. It is kept at a place on the function stack, and the place is the accumulator's value when the function is written down. C later runs the function at the place the accumulator is at.
The machine
| Command | Does |
|---|---|
i d | Add 1, take 1 away |
s | Square |
o c | Print the accumulator as a number, or as a character |
w | Print Hello, world! |
h | Halt |
{..} | Run the code inside ten times |
(..) | Skip the code inside if the accumulator is 0 |
f..f | Keep the code between the two f at the accumulator's place |
C | Run the function at the accumulator's place |
The specification leaves the accumulator's edges open. It follows Deadfish~, where the accumulator becomes 0 on reaching 256 or -1 and o ends the number with a line feed.
Example
The specification prints abc five times.
The specification prints abc five times. {i}s makes 100 and ddd brings it to 97, the code of a. The function prints a, b and c and steps back to 97, so it lands on its own place again and each C runs it once more.
The specification says every Functional deadfish and every Deadfish~ program runs too. These are its other two ways to write the same output.
Further
- esolangs.org/wiki/Functional_deadfish~
- Deadfish, the language under both.
See also
Also in Jokes
Write your own in Run Convert a program from Functional deadfish~
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: functional-deadfish.
Command line
shib run functional-deadfish -e '{i}sdddfcicicddfCCCCC'shib manual functional-deadfishSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/functional-deadfish.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org