MathGroup Archive 2006

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

Search the Archive

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


  • Prev by Date: Re: InputForm changes the order of output?
  • Next by Date: Discrete Event handling in Mathematica
  • Previous by thread: Re: delayed rule evaluation order
  • Next by thread: Re: delayed rule evaluation order