MathGroup Archive 1999

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

Search the Archive

Re: Evaluation of args in pure functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16971] Re: Evaluation of args in pure functions
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 10 Apr 1999 02:13:20 -0400
  • Organization: Universitaet Leipzig
  • References: <7ehib1$njm@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Andrea,

yes and it must. Because the arguments of usual function must be
handled by the pattern matcher, the pattern matcher need at least
a unique form to work correctly. But in your problem the situation
is different  the @ operator is evaluatet from left to right
e1 @ ( e2 @ e3)  with a low order of precedence. 
In your case Simplify[..] is evaluated before Unevaluated[] is
applied.
The Unevaluated[] here is useless because it is only to prevent 
the evaluation in funtion arguments, you need Hold[]. Unevaluated[]
is the conterpart of Evaluate[] and not of ReleaseHold[].

To "control" the argument evaluation you need only use the standard
version oft he function operator with and not a short cut like @ or //

Hope that helps
  Jens


Andrea Sosso wrote:
> 
> Hello Group:
> 
>         Mathematica seems to evaluate arguments in a different way, when
> applying pure functions rather than using the usual function form:
>         Here is and example:
>         >>> a)  Usual form
>                 In[1]:=Unevaluated[ Simplify[1 + 2 x + x^2] ]
>                 Out[5]=Unevaluated[ Simplify[1 + 2 x + x ]]
>         >>> b)  Pure function @
> 
>                 In[2]:=Unevaluated[#]& @ Simplify[1 + 2 x + x^2]
>                                           2
>                 Out[2]=Unevaluated[(1 + x) ]
> 

> Why ?
>  And how to control evaluation in pure functions ?
> 
> Thanks to anyone giving help.
> 
> --
> 
>  Andrea Sosso


  • Prev by Date: Re: Permutations & Computer capacity
  • Next by Date: Re: How to interrupt a running evaluation in MathLink
  • Previous by thread: Re: Evaluation of args in pure functions
  • Next by thread: RE: Re: Evaluation of args in pure functions