Re: delayed rule evaluation order
- To: mathgroup at smc.vnet.net
- Subject: [mg67975] Re: delayed rule evaluation order
- From: Peter Pein <petsie at dordos.net>
- Date: Thu, 20 Jul 2006 06:04:09 -0400 (EDT)
- References: <e9ku36$l10$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Chris Chiasson schrieb:
> Hold[{2, 3}] /. {{x_, y_} :> x^y}
>
> the result is Hold[Power[2,3]]
>
> I would like the result to be Hold[8]
>
> The original context is post-processing of a large Trace output (via
> SetPrecision to get rid of digits and improve readability).
>
> Any ideas?
>
Hold[{2, 3}] /. {{x_, y_} :> x^y, Hold -> Composition[Hold, Evaluate]}
--> Hold[8]
or, if you only want to process held pairs:
Hold[{2, 3}] /. Hold[{x_, y_}] :> Composition[Hold, Evaluate][x^y]
hth,
Peter