>  
> > And Øyvind, I don't think it's a bug that collect doesn't respect
> > Wild. It's just not implemented. Someone suggested that subs might do
> > substitutions using Wilds and I put that work into t2. And this thread
> > provided a test case for it, but doing expr.subs(W**(n+1), u*W**(n+1),
> > wild=1) failed because Idx (as it is being traversed by subs) doesn't
> > have methods that normal Basic objects do, e.g. as_base_exp(), so it
> > failed.
> 
> That would be cool to have implemented, though.  Or maybe some kind of lambda 
> thing, so you could just say 
> 
> collect(expr, lambda i: i.is_Indexed, lambda=True)
> 
> and it would collect all Indexed terms.  
> 

The lambda function is very good idea.  It would be extremely flexible,
and you could also use it with wildcards:

pattern = Wild('w1')**(n + 1)
collect(expr, lambda i: i.match(pattern))

But, I think it will make the learning curve much steeper if this is the
primary way to do these things.  At least I had a hard time digesting
the functional aspects of python, and it took a gsoc to finally get it
in ;-)  

Øyvind

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@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.

Reply via email to