My guess is that Mul and Add will always just create Add and Mul objects.
Other functions will then be used to perform various simplifications on
these lists.

This is how sets work with Union and Intersection.  You call Union(a, b, c,
d) where a, b, c, d are all sets.  This makes a Union object containing
these four sets.  If evaluate=True then Union asks all of a, b, c, d if
they know how to simplify themselves against any of the others.  This might
not be maximally efficient but it works surprisingly well and is very
extensible.  The organization of methods would definitely improve through
multiple dispatch.

Regarding MatrixMul, QMul, I think that multiple dispatch would allow us to
get rid of op_priority.  I think that need MatrixMul and QMul for as long
as Mul assumes its arguments are scalars.  Although maybe multiple dispatch
helps to isolate some of that logic.


On Wed, Feb 19, 2014 at 5:01 PM, Aaron Meurer <[email protected]> wrote:

> SymPy already has a pretty widely used single dispatch system (the
> _eval_* methods). Multiple dispatch would be useful for any operation
> that has more than one argument. I hardly have to convince you of the
> advantage of this approach.
>
> The challenge is operations like Add and Mul that take an arbitrary
> number of arguments. How can we reasonably dispatch the logic in
> Mul.flatten so that it's not such a mess (and also so that we don't
> need things like MatrixMul or QMul)?
>
> I haven't looked at the upapjojr pull request. My understanding is
> that it doesn't handle the Mul case, which is the one that most
> interests me.
>
> Aaron Meurer
>
> On Wed, Feb 19, 2014 at 2:04 PM, Matthew Rocklin <[email protected]>
> wrote:
> > I've recently become interested in multiple dispatch.  I know that this
> has
> > been a topic of conversation before.  Can anyone point me to relevant
> > threads?  I've gone through the recent PR by @Upapjojr
> > https://github.com/sympy/sympy/pull/2680 .
> >
> > In particular:
> >
> > 1.  What are the strong use cases for multiple dispatch within SymPy?
> >
> > 2.  What particular challenges does SymPy pose?
> >
> > 3.  What are expected benefits/drawbacks?
> >
> >
> >
> > -Matt
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sympy" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/sympy.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to