Am 13.03.2012 09:57, schrieb Aaron Meurer:
One problem is that it's not really a Matrix. Classes like Mul and Add are container objects that can hold any number of items.
Heh. That would be an infinitely-dimensional hypercube. I hadn't expected to see that in my career :-) > If we
want to assert commutativity and associativity (the latter is actually implied by the n-ary-ness of the container), we must define operations on any combination.
Urk. > In practice, this isn't an issue because rules can
be generalized.
Exactly - that's conversion, not multiple dispatch. I know of three techniques to deal with varying parameter values: - Multiple dispatch. Most general, not independently extensible. - Conversion to the most general common type, along a hierarchy. Independently extensible. Less flexible than MD: you cannot (easily) special-case a specific type combination. - Overloading. Requires explicit definition of each combination. Restricted to static types (i.e. useless for dynamic languages which don't have static types anyway). -- 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.