davedelong / DDMathParser

String → Number
MIT License
854 stars 153 forks source link

Transform functions to argumentless functions with custom operators (overriding existing functions) #162

Open tirrorex opened 5 years ago

tirrorex commented 5 years ago

Taking for example the sin function which takes an argument. I want to be able to evalue 24sin as sin(24), basically taking lhs as the argument for my function.

Creating the operator with custom token and the relation to multiply is easy but there is no documentation on how to add functionnalities to existing functions.

It seems that maybe a rewrite rule should be used ?

Any thoughts on this ?

tirrorex commented 5 years ago

Following this : Other calculators are using √ like 2√ being √(2) The library refuses this and want √2 The problem being that 2√% (which is √(2)% ) cannot be calculated without adding parentheses otherwise √(2%) is calculated which is not the same value. The result i get with the library is the one for 2%√

I assume that again a rewrite rule might allow me to do what i want but i would need further informations for this.