On Sun, Feb 12, 2012 at 7:31 AM, Andy Ray Terrel <andy.ter...@gmail.com> wrote: > FWIW, Andreas Kloeckner's Pymbolic code is closer to what Nathan is > suggesting. He builds trees and then operates on them with visitors. > Its a nice system but not nearly feature complete. SymPy relies on > quite a bit on "construction time" logic to reduce things to canonical > form. Pymbolic relies on visitors to rewrite the graph. This makes > Pymbolic faster for building simple exprs but leaves error checking > until the end of the computation. It also has the nice affect of > being very extensible. > > While I agree it would be nice to have a more general AST that can go > between these projects, I don't know that it is feasible to switch > SymPy. It would be much more work.
I was thinking about the easiest way to integrate an AST/visitor style into SymPy. Rather than move everything to use the AST style construct, I think it would be easier to have a function that converts from one form to another. Since I construct a graph that encodes the order in which the operations occurred, you could just walk from the starting points, converting in order. The main difficulty with the AST is that things which are expressions in python are statements in the AST, and behave differently. The biggest offender here are the in place operations. I have to think of a nice interface to encode multiple symbol parents to a given state as well, I'm not happy with anything I've tried so far. If you guys have any suggestions as far as how you would like to access all the symbols in an expression I would love to hear your thoughts. Nathan -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.