MathGroup Archive 2004

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

Search the Archive

Re: unevaluated, hold, holdform

  • To: mathgroup at
  • Subject: [mg50939] Re: unevaluated, hold, holdform
  • From: Paul Abbott <paul at>
  • Date: Tue, 28 Sep 2004 00:59:14 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <vas7uiw8wg82@legacy> <cj86l4$78b$>
  • Sender: owner-wri-mathgroup at

In article <cj86l4$78b$1 at>, highegg at (highegg) 

> if you want to prevent an argument from evaluation,
> Wrap it with the _Unevaluated_ function:
> Numerator[Unevaluated[(4*x^2)/(2*x)]]
> but be careful, if you use this as a function:
> f[x_]:=Numerator[Unevaluated[x]],
> f[(4*x^2)/(2*x)] won't work, the argument is pre-evaluated again!
> the best way to sort this out is to assign an argumant to the function
> f:
> AppendTo[Attributes[f],HoldAll]
> now f[(4*x^2)/(2*x)] will give us what we want!
> (but note that f[x_]:=Numerator[x] still won't work!)

Another way to do this is to use Function with the attribute HoldFirst:

 f = Function[x, Numerator[Unevaluated[x]], HoldFirst]; 


Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at 

  • Prev by Date: GUIKit and GraphEdit
  • Next by Date: Re: FindRoot for an oscillating function
  • Previous by thread: Re: unevaluated, hold, holdform
  • Next by thread: Re: unevaluated, hold, holdform