1. math

math

Represents a mathematical expression. It can contain numbers, operators, and references. However, users should be advised to ensure that there is only one reference that is considered an unknown when importing.

math must define the following keys:

When defined, it must interpret the given string as the mathematical equation given the operators and syntax listed below. It must also allow for references without using refstr type. Note that using refstr type would ignore references as they're used in the set operation.

It must support the following operators with this Order of Operations. Ones listed in the same bullet have the same precedence:

There are two unary operators that work only when there is no left-hand value. They are positive (no operation) and negative: + -

For example: 1 + 1 is the addition operator whereas 1 - +1 is the subtraction operator and the positive operator.

One must be able to represent numbers in alternate bases with the following formations (where # is the number portion):

When set, it must be given a number that represents the result of the equation. If there exists a reference pointing to an uninitialized (or dynamic, perhaps) value, it must then solve the equation for that value and set it on the reference. If there is more than one such reference or if it would use lossy operations to solve it it must generate an appropriate error. If there is no such reference then setting should act like an assertion.

When retrieved as a number, it must return the result of the equation.

For syntax highlighters, you may consider a literal or a dash string starting with a plus sign to be a math type. Additionally, don't forget about the math keystruct form: math (value)