Own functions and Contribution

Mar 10, 2014 at 11:52 AM

I want to implement some functions like floor, ceil,
These functions are Unary, and I think that I have to derive from UnaryExpression.
The more complex functions I want to implement, is Modulo %, min, and max,
I mean, normally it would be a BinaryExpression, but since you've implemented
a differentparameterexpression, I don't know which I should use.
I hope you can help, maybe you could tell me a few more steps to implement
new functions, and last but not least, how can I contribute my additions to your project?

I have a git submodule in my project to your github.com location,

Mar 12, 2014 at 10:50 AM
For creating new functions:
  1. Add a new token. In folder "Tokens". The Functions enumeration for function. The Operation enumeration for operation.
  2. Add to Lexer "if" statements. Look at ~290 line and below.
  3. Create your expression class in the "Expressions" folder. Inheritance from UnaryExpression for functions that have one argument, BinaryExpression - 2 arguments, DifferentParametersExpression - from 0 to infinity (Override MinCountOfParams and MaxCountOfParams).
  4. Add your expression to the ExpressionFactory class. (CreateOperation for operation, CreateFunction for functions).
  5. Create tests (optional).
And your can send your work as Pull Request on github.com. If code will ok, I will merge it with dev/master branch.

P.S. min/max function may have several argument. I think you have to derive from DifferentParametersExpression. % - BinaryExpression (it's operation that has only left and right operands).
Apr 22, 2014 at 1:04 PM

I've added a pull request to your github repo.
Maybe you have something to change about the _Differentiate-Method.

Best Regards