User defined functions in expressions?
Posted: Sun Apr 22, 2018 7:39 pm
I think, it would be pretty cool to let user to save and reuse arbitrary expression functions.
For example , I use as random from seed. I could save it to and use it in all my scenes.
While exprtk allows user defined functions: https://github.com/ArashPartow/exprtk/b ... .txt#L1803, their user-definition is compile-time and written in C++, so not our option.
What I think is more like preprocessor macros.
So, if user defines and when user writes in the expression, Magic converts it to before execution.
Sounds not so hard, right?
For example , I use
Code: Select all
sqrt(x*500)*5000 % 1Code: Select all
random(x)While exprtk allows user defined functions: https://github.com/ArashPartow/exprtk/b ... .txt#L1803, their user-definition is compile-time and written in C++, so not our option.
What I think is more like preprocessor macros.
So, if user defines
Code: Select all
func wat(a, b, c) = (a + b) * cCode: Select all
wat(1,2,3)Code: Select all
(1 + 2) * 3Sounds not so hard, right?