div0 icon

← Go to page index ←

MPath

(First posted on December 17th, 2021)

MPath, pronounced "em-path", is an esoteric math language that I came up with that uses prefix notation. The language is similar to the programming language LISP because of the prefix notation and quoting. It can also be more easily compiled because the types and function arities are known at compile-time.

Syntax and Values

Spaces and commas are treated as whitespace, which means they can indicate the end of a number or name. Most symbols are a single character, but user-defined variable names can be up to 2 characters long, and label names can be up to 5 characters long. The restrictions on the name lengths is to decrease ambiguity.

Below are the

Input and output operations

These are all that you could want from a calculator

Special operations

Conditions

Conditions are another type of special operation. They allow for conditional calculation or execution. Conditions are written with curly braces with any number of sub-expression elements. Each sub-expression consists of a condition mapping to a result. The expression evaluates each of the sub-expressions cases ‘c’ until one of them evaluates to non-zero. If a case evaluates to non-zero then the whole expression evaluates to the result of the corresponding sub-expression result ‘r’, but if no case was satisfied then the result is null.

Unary functions

Binary functions

Ternary functions

Dealing with null and infinity

Variables can be compared with null and infinity and make decisions based on the result of the comparison.


This page was last updated on July 29th 2022.

↑ Return to top ↑