Fysh
Every number is a fish, its scales are the bits, and a school of fish adds up.
Pointless and PinesLover69, 2024 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Pointless and PinesLover69 made Fysh in 2024. A program is drawn as fish. A variable is ><steven>, and a number is a fish whose scales are binary digits, { or } for 1 and ( or ) for 0, so ><{({°> is
Read the story
- The eyes are decoration. Fish placed side by side add up, and a fish swimming left counts against the
school.
The rest follows the theme. A heart multiplies and a broken heart divides. A whirlpool loops, a happy fish is if and a dead fish is else, a submarine is a function, a squid returns and an anchor prints.
The machine
| Fish | Means |
|---|---|
><{({°> <°)})>< | 5, and minus 2 |
><{{{-{({°> | 7.5; each bone - adds digits after the point |
><a> ><b> | a + b |
♡ <3 </3 💔 | Multiply, divide |
o~ ~o o≈ ≈o | Greater, less, at least, at most |
><a> ≈ ... ~ | Assign; every statement ends with ~ |
>><a> ~ <a><< ~ | Add 1, take 1 |
🌀 [cond] ><> ... <>< | While |
><(((^> ><(((*> | If, else |
>(f) ><x> ><> ... <>< | Define a function |
[>(f) a * b] 🦑 | Call it, return |
⚓ (+o |
The specification does not say how printing ends, and this implementation prints each value on its own line. Values are doubles and whole numbers divide without remainder.
Example
The anchor prints a fish with scales 101.
The anchor prints a fish with scales 101.
Seven minus a fish worth 2, swimming left.
The factorial of 5. The whirlpool runs while the number is above 1, the heart multiplies and the fish with two tails at the end counts down.
The recursive Fibonacci gives 13 for 7. Its calls only work if each call keeps its own a and b, so names assigned inside a function belong to that call.
Patterns it teaches
- Camouflage: a program that looks like an aquarium.
- Encoding tricks: binary numbers written as scales.
Further
See also
Also in Camouflage
Write your own in Run Convert a program from Fysh
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: fysh.
Command line
shib run fysh -e '(+o ><{({°> ~'shib manual fyshSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/fysh.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org