mathSeq

From Esolang
Jump to navigation Jump to search

mathSeq (math Sequences) is an esoteric programming language created by Threesodas. It uses the numbers 0-9 and these numbers are added together.

Syntax

Every sequence consists of a string of numbers and a semicolon to indicate the end. Numbers can be separated for readability but this does not change the meaning. For instance:

0462346"Hello45World22"; 0001Prints Hello, World!;

Can be also put as:

0 4 6 2 3 4 6 " Hello 4 5 World 2 2 ";

The number 0, when put before a string of numbers, changes how the code is interpreted. The following table shows how it can affect the code:

# of Zeros Effect
None A string is added together. 4923 = 18
One A string is read as individiual numbers. 019147 = 019147
Two A string is read in two pairs. 005075 = 125
Three There is only one valid string of numbers that uses three zeros: 0001. Any characters put between this string and a semicolon are ignored; it represents a comma. 0001Hello, Bob!; : //Hello, Bob!;

Valid Strings

Zero-Zero strings

Zero-Zero strings (strings that do not start with a zero) are added together. Below is a list of sums and their functions:

10 : compare two values. Any two or more values listed after this (separated by a colon) are compared.
    The final value should have a question mark instead of a colon before it, and the final value is used as the operator.
    Keep reading below for each operator.
  Usage: 10:<Value1>:<Value2>?<Operator>;
  Example: 55:22:49?59;
11 : An equal operator. This operator is used to both compare integers and strings.
  Usage: 10:<Value1>:<Value2>?11;
  Example: 55:"33":33?56;
12 : A less than operator. This operator is used to compare integers.
  Usage: 10:<Value1>:<Value2>?12;
  Example: 55:13:44:67?57;
13 : A greater than operator. This operator is used to compare integers.
  Usage: 10:<Value1>:<Value2>?13;
  Example: 55:45:8?58;
14 : A less than or equal to operator. This operator is used to compare integers.
  Usage: 10:<Value1>:<Value2>?14;
  Example: 55:20:20?59;
15 : A greater than or equal to operator. This operator is used to compare integers.
  Usage: 10:<Value1>:<Value2>?15;
  Example: 55:22:49?555;
16 : A not operator. This operator is used to compare strings and integers.
  Usage: 10:<Value1>:<Value2>?16;
  Example: 55:"Hello World":"Hello Earth"?565;

One Zero Strings

One Zero Strings are strings that start with only one zero. They are read as individual numbers. These strings are specific and cannot be interchanged since they do not add up to a sum which defines a specific function.

01914799 : Define a variable.
  Usage: 01914799"Varname"?<Value>;
  Example: 019147"x"?"Hello, World!";
03849182 : Use a variable.
  Usage: 03849182"Varname";
  Example: 55:03849182"x":30?56;
04111391 : Redefine an existing variable.
  Usage: 04111391"Varname"?<NewValue>;
  Example: 04111391"x"?44;
05991991 : If statement. The sequence directly after this must be a "begin block" sequence.
  Usage: 05991991(<Comparison>);
  Example: 05991991(55:03849182"x":44?554);
06222222 : Begin code block sequence. Use before if statements, while loops and functions.
  Usage: 06222222;
  Example: 06222222;
06222223 : End code block sequence.
  Usage: 06222223;
  Example: 06222223;
06254234 : Else statement.
  Usage: 06254234;
  Example: 06254234;
06254236 : Else if statement.
  Usage: 06254236(<Comparison>);
  Example: 06254236(55:03849182"x":50?555);
07182813 : Define a function. Arguments are not required.
  Usage: 07182813"<FunctionName>"?03849182"<ArgumentVariable>";
  Example: 07182813"myFunc";
07999999 : Use a function.
  Usage: 07999999"<FunctionName>"?<Args>;
  Example: 07999999"add"?50:50;
08020913 : While loop.
  Usage: 08020913(<Condition>);

Two Zero Strings

There are two possible sums for strings that start with two zeros:

100 : Print a string.
  Usage: 005050"<String>";
  Example: 005050"Hello, World!";
    Sidenote: To print a variable, you must use a ?
    Example: 005050?03849182"myVar";
125 : Take user input.
  Usage: 005075;
  Example: 04111391"input"?005075;

Three Zero Strings

There is one string that starts with three zeros.

0001 : Comment
  Usage: 0001<Comment>;
  Example: 0001Hello, World!;

Example Programs

Cat program

08020913(55:1:1?56);
06222222;
  01914799"input"?005075;
  005050?03849182"input";
06222223;