Re: ReplaceAll on Nested Expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg92934] Re: ReplaceAll on Nested Expressions
- From: "David Park" <djmpark at comcast.net>
- Date: Mon, 20 Oct 2008 07:34:17 -0400 (EDT)
I found one method - MapAll. Fold[foo[#1, #2] &, a, {b, c, d, e}] MapAll[# /. foo[a_, b_] :> foo[a, h[b]] &, %] foo[foo[foo[foo[a, b], c], d], e] foo[foo[foo[foo[a, h[b]], h[c]], h[d]], h[e]] -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "David Park" <djmpark at comcast.net> wrote in message news:... > Here is an attempted replacement: > > foo[foo[a, b], c] /. foo[a_, b_] :> foo[a, h[b]] > foo[foo[a, b], h[c]] > > How could I write a rule, or what method would I use so that the inner > foo[a,b] is also replaced? > > foo[foo[a, h[b]], h[c]] > > -- > David Park > djmpark at comcast.net > http://home.comcast.net/~djmpark/ > >