matheval / expression-evaluator-c-sharp

Matheval is a mathematical expressions evaluator library written in C#. Allows to evaluate mathematical, boolean, string and datetime expressions
https://matheval.org/
MIT License
107 stars 29 forks source link

Proposed enhancements for issue #7, based on work by MSpekkio #19

Open bwakabats opened 11 months ago

bwakabats commented 11 months ago

Resolves issue #7 with the ability to register external function. Based on work by @MSpekkio in #9

The static Parser.RegisterFunction allows the registration of a type (derived from IFunction) or an instance of the same.

The functions can:

NOTE: There are 2 changes to the underlying code:

  1. The name of the function is now derived from the FunctionDef.Name, rather than part of the IFunction class name. So a single IFunction could, in theory, accommodate more than one math function.
  2. IFunctions must now be stateless (all existing internal IFunctions already are) since a single instance of each function is reused.
jramoseguinoa commented 7 months ago

@bwakabats nice work! @butulia @matheval can you please accept this PR and release a new nuget version?

mikhail-teslya commented 2 months ago

A wanted feature, is the one expected to be reviewed @butulia @matheval? Thanks for the effort :)

dei79 commented 1 month ago

@mikhail-teslya, @bwakabats and @jramoseguinoa I derived my own version of this awesome library and included the external functions capability. Just case you need this feature: https://github.com/dei79/ExpressionEvaluationRuntime