MathGroup Archive 2006

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

Search the Archive

Re: delayed rule evaluation order

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68021] Re: delayed rule evaluation order
  • From: "sashap" <pavlyk at gmail.com>
  • Date: Thu, 20 Jul 2006 06:05:00 -0400 (EDT)
  • References: <e9ku36$l10$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Look at the refguide entry for ReplaceAll. It gives an example of

evaluatePatternMatches[heldexpr_Hold, patt_] :=
 heldexpr /.p_ /; MatchQ[Unevaluated[p], patt] :> With[{eval = p}, eval
/; True]

which illustrates the way to make rule evaluate inside held
expressions.

In[3]:=
Hold[{2,3}]/.{{x_,y_} :> With[{m=x^y},m/;True]}

Out[3]=
Hold[8]

Oleksandr Pavlyk
Wolfram Research



Chris Chiasson wrote:
> 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?
> 
> -- 
> http://chris.chiasson.name/


  • Prev by Date: Re: delayed rule evaluation order
  • Next by Date: Re: hadamard finite part
  • Previous by thread: RE: delayed rule evaluation order
  • Next by thread: Re: delayed rule evaluation order