Open redrossa opened 3 years ago
Is there a mapper for listing all subexpressions of an expression? For example, x + 2*y becomes [x + 2*y, 2*y, x, y], sorted based on precedence. Otherwise, if you like the idea, I'm willing to create a PR for it.
x + 2*y
[x + 2*y, 2*y, x, y]
You can probably subclass the WalkMapper to easily do what you want. It calls self.visit for every node.
WalkMapper
self.visit
Is there a mapper for listing all subexpressions of an expression? For example,
x + 2*y
becomes[x + 2*y, 2*y, x, y]
, sorted based on precedence. Otherwise, if you like the idea, I'm willing to create a PR for it.