Non-specific assignment

From Esolang
Jump to navigation Jump to search

Non-specific assignment is a rarely-used abstract concept in esoteric and traditional programming derived from algebraic inequalities and such that allows the programmer to, for example, set a variable x to every value except 5.

Examples

The syntax of the basic (non-augmented) non-specific assignment operators will vary by language, but here's an example list:

Operator Meaning
x := 5 (Traditional) Assign to x the value 5
x :< 5 Assign to x all values less than 5
x :> 5 Assign to x all values greater than 5
x :<= 5 Assign to x all values less than or equal to 5
x :>= 5 Assign to x all values greater than or equal to 5
x :!= 5 Assign to x all values that are not 5

Implementation

NSA can be accomplished by including 3 bits (8 possible combinations) of metadata for every variable assigned. These 3 bits contain a value telling the program what kind of definition that variable corresponds to. All arithmetic operations are simply performed on the value of the operator and the 3 metabits are left the same, and it should work normally. Relational operators are a bit more complicated, but can still be accomplished (though the syntax would get confusing)

Actual usefulness

In violation of the Prime Directive of Esolangs, non-specific assignment could, in theory, actually be useful for representing algebraic inequalities or something.