semantic-math / math-rules

Manipulate math-ast ASTs based on algebraic rules
MIT License
4 stars 1 forks source link

Allow placeholders to be optional in multiplication operations #26

Open kevinbarabash opened 7 years ago

kevinbarabash commented 7 years ago
rule: #a_0?1 #b + ... --> (#a_0 + ...) #b
example: x + 2x + 3x --> (1 + 2 + 3) x

The thinking is that ? would indicate that the placeholder before it is optional. The value after the ? would be the value to use if the placeholder doesn't exist. We could also not bother with this fallback value b/c for multiplication we'll almost always want this to be 1.