Fit

From Esolang
Jump to navigation Jump to search

Fit is an esoteric programming language by User:Madk which uses numbers in base 5 (termed 'fits') to compute things. Each fit contains a number from -2 through +2 inclusive.

Commands

+	rotate current fit digit; -2 → -1; -1 → 0; 0 → 1; 1 → 2; 2 → -2
-	rotate fit backwards
~	negate fit
(	jump past the corresponding ) if the current cell = 0
)	jump back to matching ( if the current cell is ≠ 0
{	jump past matching } if the cell is ≥ 0
}	jump back to { if the cell is < 0
[	jump past matching ] if the cell is ≤ 0
]	jump back to [ if the cell is > 0
/	jump past matching \ if the cell is ≠ 0
\	jump back to / if the cell is = 0
?	skip the following instruction if the current cell is = 0
!	skip the following instruction if the current cell is ≠ 0
^	skip the following instruction if the current cell is > 0
v	skip the following instruction if the current cell is < 0
=	destroy the current cell, following cell takes place under the pointer and all following cells are shifted left once to fill the gap
<	move cell pointer left
>	move cell pointer right
_	set the ASCII byte counter to 0
,	add the current ternary cell to the ASCII byte counter
;	output the ASCII byte counter, which is always 59 (the ASCII value for the character ;) at program start
n	output a newline
.	output the number under the pointer
:	get input for the number under the pointer
#	begin/end comment

Examples

Hello, world!

++,,,,,,-,;_+,''',,,,,'+,-'-,;,+,,,;;,-,;_+,''',,,';_,'''';''+,,,,+,;-,,,,;-,-,;++,,,;,,,,;_-,''''-,;

Cat

+[>:.n<]

Quine

;

Computational class

Fit is turing-complete by reduction from Boolfuck, which reduces from its parent language brainfuck.

Boolfuck function Fit commands
>
>
<
<
+
[--]+
[
(
*]
*)

* : Equivalent control flow

External resources

Download Fit interpreter