Re: Pattern matching in functions
- To: mathgroup at smc.vnet.net
- Subject: [mg54388] Re: [mg54379] Pattern matching in functions
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 20 Feb 2005 00:07:48 -0500 (EST)
- References: <200502190732.CAA06160@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 19 Feb 2005, at 08:32, Maximilian Ulbrich wrote:
> 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
>
>
>
Cases[l^4*a[b][l] + l*a[c][l], x_a[y_] :> First[x], Infinity]
{b,c}
Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/andrzej/index.html
http://www.mimuw.edu.pl/~akoz/
- References:
- Pattern matching in functions
- From: Maximilian Ulbrich <mulbrich@berkeley.edu>
- Pattern matching in functions