Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Pattern matching in functions

  • To: mathgroup at
  • Subject: [mg54419] Re: Pattern matching in functions
  • From: "Steve Luttrell" <steve_usenet at>
  • Date: Sun, 20 Feb 2005 00:09:04 -0500 (EST)
  • References: <cv6sop$6pj$>
  • Sender: owner-wri-mathgroup at

This does what you want:

Cases[l^4*a[b][l] + l*a[c][l],a[y_][_]->y, {0, Infinity}]

Steve Luttrell

"Maximilian Ulbrich" <mulbrich at> wrote in message 
news:cv6sop$6pj$1 at
> Hi,
> I would like to find subexpressions using Cases.
> In the following case, I expected to find a[b] and a[c] and therefore
> get {b,c} as the result. However, I get {l,l}.
> What happens and how can I solve this?
> Cases[l^4*a[b][l] + l*a[c][l], x_a[y_] -> y, {0, Infinity}]
> Thanks,
> Max

  • Prev by Date: Re: computing cumulative sum for list
  • Next by Date: Re: Pattern matching in functions
  • Previous by thread: RE: Pattern matching in functions
  • Next by thread: Re: Pattern matching in functions