From Esolang
Jump to: navigation, search

ContinuousEquation is an esoteric programming language invented by User:Zzo38. Program flow runs by continuous equations rather than by discrete steps.

Each line is the x and y position of the command, in numerator and denominator form a/b or in decimal form, and the command at that position. You can do repeated commands by replacing x and/or y with a range and step (low;high;step) for example (0;1;1/10) or (10;;4), so you are allowed to omit low or high if you want, but not both. But there is no use making x negative because program flow doesn't go negative. Comments start with # at beginning of line.

Program starts at x=0 and current function f(x)=0 and it runs continuously forward to find a command that the equation y=f(x) touches to execute.

The commands are:

R a     restart at x=0 and set current function to a.
F a     Set current function to a.
o a     Output the number (or ASCII character) a. You can put multiple parameters to output multiple numbers/characters.
!       Continuation of previous line. Do not type x and y position again.

The functions are:

numbers Numbers are indicated by the number in decimal form (with .) and another . at end.
+ a b   Add a and b together.
- a     Negative a.
* a b   Multiply a by b.
/ a b   Divide a by b.
% a b   Modulo a by b, always returns positive if b is positive.
| a     Absolute value of a.
q a     Round a down to a integer toward negative infinity.
< a b   Choose a or b whichever is less.
> a b   Choose a or b whichever is greater.
x       Variable of function, invalid outside of function definition.
f a     Current function of a, evaluated at time of command execution.
X       Evaluate x coordinate of current command (immediate).
Y       Evaluate y coordinate of current command (immediate).
I       Input a number (or ASCII character) (immediate, at time of command execution). You can't do more than once per command.
z       Shortcut for number zero.
'       Follow by a ASCII character to use the number that corresponds to it. Only valid in character I/O mode.

Example of a command line:

3.25 (-5;5;0.5) R>z+-1..f+x1..

There are no irrational numbers, program execution ends when current function is set to something that is always undefined or if program flow runs past all commands, or if you prove that no more commands will be reached.


Cat program (assumes EOF is negative):

0 0 FI
1 (0;;1) oY
2 (0;;1) Rz

Program to square the input number:

0 0 F*I<xz
1 0 o*f-1..f-1..

"Hello, world!" program:

0 0 o'H'e'l'l'o',' 'w'o'r'l'd'!

Beer program (uses UNIX newline):

2.9 0 F99..
(1;5;2) (10;99;1) o+'0q/Y10..
(2;6;2) (1;99;1) o+0%Y10..' 'b'o't't'l'e's' 'o'f' 'b'e'e'r
2.5 (1;99;1) o10..10..
4.5 (1;99;1) o' 'o'n' 't'h'e' 'w'a'l'l10..
7 (1;99;1) o10..'T'a'k'e' '1' 'd'o'w'n',' 'p'a's's' 'i't' 'a'r'o'u'n'd10..
8 (2;99;1) R+-1..Y
8 1 o'N'o' 'm'o'r'e' 'b'o't't'l'e's' 'o'f' 'b'e'e'r' 'o'n' 't'h'e' 'w'a'l'l'.