Functional deadfish~

From Esolang
Jump to navigation Jump to search

Functional deadfish~

Functional deadfish~ is a combination of Functional deadfish and Deadfish~. It has a single accumulator, which ranges from 0-255 unless squared, and a function stack.

Commands

Caption text
Command Result
i Increment accumulator
d Decrement accumulator
s Square accumulator
o Output accumulator as number
c Output accumulator as character
w Output "Hello, world!"
h Halt program
{} Run code inside braces 10 times
() Skip code inside parentheses if accumulator is 0
f Delimit function declaration
C Call function

Functional deadfish~ also has a function stack. Any code between two matching fs is pushed to the function stack at the accumulator value before the fs.

C calls the function at the accumulator's position in the function stack.

Implementation

An implementation is available here

Example programs

Any valid deadfish~ or functional deadfish program is a valid functional deadfish~ program, however, the two's features can be combined to become very powerful and concise.

Say you wanted to print 'abcabcabcabcabc':

In Deadfish~, you'd have the ugly {i}sdddcicicddcicicddcicicddcicicddcicicdd, where you have to type the print code five times.

In Functional deadfish, you'd have iiisisdddfcicicddfCCCCC - Simpler, but the code for getting to 97 is more complicated.

In Functional deadfish~, you can use the good points of both to end up with {i}sdddfcicicddfCCCCC.