Re: Re: Programming style: postfix/prefix vs. functional
- To: mathgroup at smc.vnet.net
- Subject: [mg70671] Re: [mg70633] Re: [mg70587] Programming style: postfix/prefix vs. functional
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Sun, 22 Oct 2006 01:20:41 -0400 (EDT)
- References: <200610200921.FAA11092@smc.vnet.net> <200610210914.FAA29189@smc.vnet.net> <453A4431.5040102@math.umass.edu>
You just made me realize I typed my question incorrectly. @ isn't in the documentation for Operate as I originally said. It's in the documentation for Composition. Seeing it written out like Composition[f,g][expr] and f@g[expr] does help drive the point home 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]] On 10/21/06, Murray Eisenberg <murray at math.umass.edu> wrote: > @ is an abbreviation for Composition: > > Composition[f, g][expr] > f[g[expr]] > > f@g[expr] > f[g[expr]] > > But this one is a bit difficult to discover from the documentation. If > you know the term "Composition", then of course you can do the reverse > look-up in the Help Browser. > > Unfortunately, if you try the Help Browser directly for "@", even using > the Master Index tab, you won't find it! > > Moreover, if you try the default Built-in Functions tab you search for > @, you'll be taken to the entry for Apply (@@). > > So this is definitely a gap in the documentation indexing. > > > Chris Chiasson wrote: > > One thing I have wondered is, what function corresponds to the short > > hand "@". I know @ appears in Operate. Also, the ? can sometimes tell > > what function an operator represents (try ?/@ ) , but ?@ only gives > > System`$ (the symbol $ in the context System). > > > > > > On 10/20/06, Will Robertson <wspr81 at gmail.com> wrote: > >> Hello, > >> > >> As a newcomer to Mathematica, I'm a little unsure on what "good style" > >> would be in this programming language. I notice that several functions > >> have prefix and postfix notations such as //. for ReplaceRepeated, /@ > >> for Map, and so on. > >> > >> Clearly using these forms makes the code more compact, but sacrifices > >> some level of readability. Are there guidelines or suggestions that > >> have built up over the years of whether these are "good" or "bad" to > >> use? > >> > >> If it's simply personal preference, what do you like to use? > >> -- > >> Many thanks, > >> Will Robertson > >> > >> > > > > > > -- > Murray Eisenberg murray at math.umass.edu > Mathematics & Statistics Dept. > Lederle Graduate Research Tower phone 413 549-1020 (H) > University of Massachusetts 413 545-2859 (W) > 710 North Pleasant Street fax 413 545-1801 > Amherst, MA 01003-9305 > -- http://chris.chiasson.name/
- References:
- Programming style: postfix/prefix vs. functional
- From: "Will Robertson" <wspr81@gmail.com>
- Re: Programming style: postfix/prefix vs. functional
- From: "Chris Chiasson" <chris@chiasson.name>
- Programming style: postfix/prefix vs. functional