-
Notifications
You must be signed in to change notification settings - Fork 20
Rules
Expresso aims to be ex extendable.
Rules are just clauses: (rule old-exp new-exp) They fail if they are not applicable. Otherwise they return the new-exp
- this makes it possible to write a rule calculo, which checks if there are no variables in the expression and calculates the result
mikera: do these apply to all possible transformations? or just simplifications? general transformations are probably more complex, since they may need to transform both directions. Simplification is easier, since it always means transformation in the direction of the standard form of expression
the rule macro provides experimental syntax for rules - using matche-syntax
apply-ruleso takes a vector of rules and a expression. returns a modified expression or faiils. It successievly tries to apply the rules in the vector, returning the modified expression if one rule succeeds. Fails if all rules fail