Re: Programming style: postfix/prefix vs. functional

• To: mathgroup at smc.vnet.net
• Subject: [mg70672] Re: Programming style: postfix/prefix vs. functional
• From: "Szabolcs Horvát" <szhorvat at gmail.com>
• Date: Mon, 23 Oct 2006 02:49:37 -0400 (EDT)
• References: <200610200921.FAA11092@smc.vnet.net> <200610210914.FAA29189@smc.vnet.net> <453A4431.5040102@math.umass.edu> <ehf226\$5hh\$1@smc.vnet.net>

```Chris Chiasson wrote:
> I guess one question I have about that is:
>
> Why aren't these two expressions identical
>
> In[1]:=
> HoldComplete[f@g[a]]//FullForm
> HoldComplete[Composition[f,g][a]]//FullForm
>
> Out[1]//FullForm=
> HoldComplete[f[g[a]]]
>
> Out[2]//FullForm=
> HoldComplete[Composition[f,g][a]]
>

That is because, as Andrzej Kozlowski already mentioned, @ does not
correspond to Composition, but f@x is just a shorthand for f[x]. Just
search for @ in the Master Index and see section 2.1.3 in the
Mathematica book. There you will find:

fâ??[x, y] , standard form for fâ??[x, y]
f @ x , prefix form for fâ??[x]
x // f , postfix form for fâ??[x]
x ~ f ~ y , infix form for fâ??[x, y]

Also note that (f@g)[x] and f@g[x] mean different things.

Szabolcs HorvÃ¡t

```

• Prev by Date: RE: Strange newbie problem
• Next by Date: Re: are there any methods of figuring out how "large" a piece of typeset textual data will be?
• Previous by thread: Re: Re: Programming style: postfix/prefix vs. functional
• Next by thread: Re: Re: Programming style: postfix/prefix vs. functional