SET

by AbyssDragon
All-Purpose Expression Evaluator (mostly mathematical at this point)
ID:91576
 
SET stands for "SET Evaluates Things".

It evaluates mathematical expressions at runtime, in much the same way the BYOND compiler does at compile-time. It handles arbitrarily complex expressions without a problem.
Just call SET(expression) and it shall! For example, SET("((2+1)*(5+7)/3)**3") will return "1728".
Currently, there are no known bugs. There are, however, several limitations--mostly in how it handles imaginary numbers.

It may eventually be expanded to do things like perl regular expressions, if I have the interest and if you show support.

Features:
***************
Nearly all operators that BYOND supports. In addition, it features X for cross product of vectors, U for union of two lists, and I for intersection.
It supports many functions. A complete listing is in SET.dm. It also allows for a few mathematical constants. Complex (imaginary) numbers are handled in most situations.
It supports several datatypes other than numbers--strings, vectors, and lists. Vector arithmetic is mostly complete, although cross-product of vectors with more than three components won't be added until matrices are. Strings have limited use as of yet, but will probably be the area the library expands in the most. Operations done to lists are distributed through to all of their members, so "list(1,2,3)+1" evaluates as "list(2,3,4)".

This documentation (and even the internal docs) has not yet been updated. There are several features (like variables) that are not yet documented here. Explore! Play with it!

For news and updates, go to molotov.nu.

Return to AbyssDragon.TheAbyss