|
[Date Index]
[Thread Index]
[Author Index]
Re: unevaluated, hold, holdform
- To: mathgroup at smc.vnet.net
- Subject: [mg50939] Re: unevaluated, hold, holdform
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 28 Sep 2004 00:59:14 -0400 (EDT)
- Organization: The University of Western Australia
- References: <vas7uiw8wg82@legacy> <cj86l4$78b$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cj86l4$78b$1 at smc.vnet.net>, highegg at seznam.cz (highegg)
wrote:
> 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];
Cheers,
Paul
--
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 physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul
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
|