Re: delayed rule evaluation order
- To: mathgroup at smc.vnet.net
- Subject: [mg67999] Re: [mg67967] delayed rule evaluation order
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Thu, 20 Jul 2006 06:04:41 -0400 (EDT)
- References: <11710934.1153306359682.JavaMail.root@eastrmwml07.mgt.cox.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks to Kozlowski's, Hanlon's and Pein's solutions (haven't received any others so far), I am now using this type of replacement: Hold[5.55555555]/.{blah_?InexactNumberQ:> junk[SetPrecision[blah,3]]}/.junk->Evaluate Hold[5.56] However, this still does not totally work on Trace's output: In[1]:= f[1]=1; f[n_Integer]/;n>1=n f[n-1]; InputForm[z=Trace[f[2]]] Out[3]//InputForm= {HoldForm[f[2]], {HoldForm[2 > 1], HoldForm[True]}, HoldForm[2*f[-1 + 2]], {{HoldForm[-1 + 2], HoldForm[1]}, HoldForm[f[1]], HoldForm[1]}, HoldForm[2*1], HoldForm[2]} In[4]:= InputForm[z/.{blah_?ExactNumberQ:>junk[SetPrecision[blah,3]]}/.junk->Evaluate] Out[4]//InputForm= {HoldForm[2.`2.9999999999999996], {HoldForm[Evaluate[SetPrecision[2, 3]] > Evaluate[SetPrecision[1, 3]]], HoldForm[True]}, HoldForm[2.`2.9999999999999996], {{HoldForm[1.`2.9999999999999996], HoldForm[1.`2.9999999999999996]}, HoldForm[1.`2.9999999999999996], HoldForm[1.`2.9999999999999996]}, HoldForm[2.`2.9999999999999996], HoldForm[2.`2.9999999999999996]} Notice the leftover Evaluate and SetPrecision commands. Does anyone have ideas on how to get this to work? On 7/19/06, Bob Hanlon <hanlonr at cox.net> wrote: > Hold[{2, 3}] /. > {Hold[{x_, y_}] :> Hold[Evaluate[x^y]]} > > Hold[8] > > > Bob Hanlon > > ---- Chris Chiasson <chris at chiasson.name> 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/ > > > > -- > > Bob Hanlon > hanlonr at cox.net > > > -- http://chris.chiasson.name/