Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8944 > unrolled thread

Re: new functional operator

Started byBill Rowe <readnews@sbcglobal.net>
First post2012-03-10 11:16 +0000
Last post2012-03-28 09:57 +0000
Articles 13 — 6 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: new functional operator Bill Rowe <readnews@sbcglobal.net> - 2012-03-10 11:16 +0000
    Re: new functional operator roby <roby.nowak@gmail.com> - 2012-03-14 05:34 +0000
      Re: new functional operator John Doty <noqsiaerospace@gmail.com> - 2012-03-18 07:43 +0000
        Re: new functional operator roby <roby.nowak@gmail.com> - 2012-03-20 07:19 +0000
      Re: new functional operator John Doty <noqsiaerospace@gmail.com> - 2012-03-21 10:47 +0000
      Re: new functional operator DrMajorBob <btreat1@austin.rr.com> - 2012-03-21 10:48 +0000
        Re: new functional operator roby <roby.nowak@gmail.com> - 2012-03-22 10:51 +0000
      Re: new functional operator Barrie Stokes <Barrie.Stokes@newcastle.edu.au> - 2012-03-22 10:54 +0000
        Re: new functional operator roby <roby.nowak@gmail.com> - 2012-03-23 06:33 +0000
      Re: new functional operator DrMajorBob <btreat1@austin.rr.com> - 2012-03-24 07:05 +0000
        Re: new functional operator Ray Koopman <koopman@sfu.ca> - 2012-03-25 05:15 +0000
      Re: new functional operator Barrie Stokes <Barrie.Stokes@newcastle.edu.au> - 2012-03-26 06:51 +0000
        Re: new functional operator roby <roby.nowak@gmail.com> - 2012-03-28 09:57 +0000

#8944 — Re: new functional operator

FromBill Rowe <readnews@sbcglobal.net>
Date2012-03-10 11:16 +0000
SubjectRe: new functional operator
Message-ID<jjfd6e$7u7$1@smc.vnet.net>
On 3/9/12 at 6:09 AM, roby.nowak@gmail.com (roby) wrote:

>Ok, next version.

>One can look for an prefix operator with no buit in meaning to
>modify the function in question such that it acts mapping, this way
>we can use the standard // postfix operator and just modify the
>behavoir of the function:

>\[Del] fn_ := fn /@ # &

>{1,2,3,4}//\[Del]f//\[Del]g

>Out[5]= {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

>(looks all nice in a Notebook)

I don't have any problem agreeing this notation looks nicer than say

{1, 2, 3, 4} // f /@ # & // g /@ # &

And, I can set up the definition in init.m so that it is always
available without needing to define it in each notebook where I
would use it.

But it presents another issue. Unless you are writing code for
yourself you will never share with someone else, you will be
making your code much more difficult to understand.

Arguably something like

f/@{1,2,3,4}

is already opaque to a new Mathematica user in terms of
understanding code. But, since this is standard syntax one could
highlight the /@ then use the built-in documentation to
determine what the code is doing. But once you start using
custom notation, this ability is lost. Then, even a well
seasoned user will have great difficulty in determining what the
code does.

And in fact, unless you use such custom notation often, you are
likely to have difficulty with your own code if you need to
review/modify it say a year or two after it was written.

[toc] | [next] | [standalone]


#9017

Fromroby <roby.nowak@gmail.com>
Date2012-03-14 05:34 +0000
Message-ID<jjpakk$ov1$1@smc.vnet.net>
In reply to#8944
>
> I don't have any problem agreeing this notation looks nicer than say
>
> {1, 2, 3, 4} // f /@ # & // g /@ # &
>
> And, I can set up the definition in init.m so that it is always
> available without needing to define it in each notebook where I
> would use it.
>
> But it presents another issue. Unless you are writing code for
> yourself you will never share with someone else, you will be
> making your code much more difficult to understand.
>



Thats why I would prefer /// as postfix-map operator to be implemented
by the Mathematica staff.
Any Mathematica staff member listening ?

Robert

[toc] | [prev] | [next] | [standalone]


#9107

FromJohn Doty <noqsiaerospace@gmail.com>
Date2012-03-18 07:43 +0000
Message-ID<jk43ni$ds0$1@smc.vnet.net>
In reply to#9017
On Tuesday, March 13, 2012 11:34:12 PM UTC-6, roby wrote:
> >
> > I don't have any problem agreeing this notation looks nicer than say
> >
> > {1, 2, 3, 4} // f /@ # & // g /@ # &
> >
> > And, I can set up the definition in init.m so that it is always
> > available without needing to define it in each notebook where I
> > would use it.
> >
> > But it presents another issue. Unless you are writing code for
> > yourself you will never share with someone else, you will be
> > making your code much more difficult to understand.
> >

Not any more so than any other specialized function you might define for your problem. You always need to be clear about notation and conventions in Mathematica code. This case is much easier than most, I think.

> 
> 
> 
> Thats why I would prefer /// as postfix-map operator to be implemented
> by the Mathematica staff.
> Any Mathematica staff member listening ?


Please, no. Mathematica is already bloated with functions trivially implementable using more basic functions. That creates a information fog that makes *all* Mathematica code harder to understand, and Mathematica much harder to learn than it used to be.

[toc] | [prev] | [next] | [standalone]


#9158

Fromroby <roby.nowak@gmail.com>
Date2012-03-20 07:19 +0000
Message-ID<jk9b1r$bj1$1@smc.vnet.net>
In reply to#9107
> That creates a information fog that makes *all* Mathematica code harder to understand, and Mathematica much harder to learn than it used to be.

{1, 2, 3, 4} /// f///g


> {1, 2, 3, 4} // f /@ # & // g /@ # &

sorry but I absolutly can't agree with your opinion in this case, the
former expression is more or less fogless and would be much easier to
understand.
The latter expression bears a lot of clutter.

Robert


[toc] | [prev] | [next] | [standalone]


#9176

FromJohn Doty <noqsiaerospace@gmail.com>
Date2012-03-21 10:47 +0000
Message-ID<jkcbji$qfr$1@smc.vnet.net>
In reply to#9017
On Tuesday, March 20, 2012 1:19:23 AM UTC-6, roby wrote:
> > That creates a information fog that makes *all* Mathematica code harder to understand, and Mathematica much harder to learn than it used to be.
>
> {1, 2, 3, 4} /// f///g
>
>
> > {1, 2, 3, 4} // f /@ # & // g /@ # &
>
> sorry but I absolutly can't agree with your opinion in this case, the
> former expression is more or less fogless and would be much easier to
> understand.
> The latter expression bears a lot of clutter.
>
> Robert

It isn't clutter in any specific piece of code that's the problem: it's all the cluttered documentation. Many of us appreciated the wonderful Mathematica book when it existed, but Mathematica has too many unnecessary functions these days, so a book is impractical. A vast fog of hypertext isn't as easy to navigate as a book. For functions like the one we're discussing, it's much better to define it only when needed. Then, those trying to understand code that *doesn't* use that function (almost all Mathematica code ever written) won't have to waste time looking past it in the documentation.

[toc] | [prev] | [next] | [standalone]


#9184

FromDrMajorBob <btreat1@austin.rr.com>
Date2012-03-21 10:48 +0000
Message-ID<jkcbme$qh6$1@smc.vnet.net>
In reply to#9017
Here SIX several equivalent expressions from (IMHO) most intuitive or  
readable to least:

Composition[g, f] /@ {1, 2, 3, 4}

{g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

g /@ f /@ {1, 2, 3, 4}

{g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

Apply[Composition, {g, f}] /@ {1, 2, 3, 4}

{g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

g@f@# & /@ {1, 2, 3, 4}

{g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

Compose[g, f@#] & /@ {1, 2, 3, 4}

{g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

{1, 2, 3, 4} // f /@ # & // g /@ # &

{g[f[1]], g[f[2]], g[f[3]], g[f[4]]}

The last is truly awful.

Bobby

On Tue, 20 Mar 2012 02:18:47 -0500, roby <roby.nowak@gmail.com> wrote:

>> That creates a information fog that makes *all* Mathematica code harder  
>> to understand, and Mathematica much harder to learn than it used to be.
>
> {1, 2, 3, 4} /// f///g
>
>
>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>
> sorry but I absolutly can't agree with your opinion in this case, the
> former expression is more or less fogless and would be much easier to
> understand.
> The latter expression bears a lot of clutter.
>
> Robert
>
>
>


-- 
DrMajorBob@yahoo.com

[toc] | [prev] | [next] | [standalone]


#9196

Fromroby <roby.nowak@gmail.com>
Date2012-03-22 10:51 +0000
Message-ID<jkf08e$8ke$1@smc.vnet.net>
In reply to#9184
Hi Bobby

Well, if you remeber I was looking for a postfix style.
As such 5 out of your 6 suggestitions disqualify, the 6th one is the
"truly awful" original notation I was trying to replace.
Further I was looking for an operator form so again 3 out of 6
suggestitions disqualify.

Robert

On 21 Mrz., 11:48, DrMajorBob <btre...@austin.rr.com> wrote:
> Here SIX several equivalent expressions from (IMHO) most intuitive or
> readable to least:
>
> Composition[g, f] /@ {1, 2, 3, 4}
>
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>
> g /@ f /@ {1, 2, 3, 4}
>
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>
> Apply[Composition, {g, f}] /@ {1, 2, 3, 4}
>
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>
> g@f@# & /@ {1, 2, 3, 4}
>
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>
> Compose[g, f@#] & /@ {1, 2, 3, 4}
>
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>
> {1, 2, 3, 4} // f /@ # & // g /@ # &
>
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>
> The last is truly awful.
>
> Bobby
>
>
>
>
>
>
>
>
>
> On Tue, 20 Mar 2012 02:18:47 -0500, roby <roby.no...@gmail.com> wrote:
> >> That creates a information fog that makes *all* Mathematica code harder
> >> to understand, and Mathematica much harder to learn than it used to be.
>
> > {1, 2, 3, 4} /// f///g
>
> >> {1, 2, 3, 4} // f /@ # & // g /@ # &
>
> > sorry but I absolutly can't agree with your opinion in this case, the
> > former expression is more or less fogless and would be much easier to
> > understand.
> > The latter expression bears a lot of clutter.
>
> > Robert
>
> --
> DrMajor...@yahoo.com

[toc] | [prev] | [next] | [standalone]


#9200

FromBarrie Stokes <Barrie.Stokes@newcastle.edu.au>
Date2012-03-22 10:54 +0000
Message-ID<jkf0c9$8lb$1@smc.vnet.net>
In reply to#9017
Hi Bobby

I agree with your sentiments.  The folk who like {1, 2, 3, 4} // f /@ # & // g /@ # & are those who regret the passing of assembly coding by hand, which opened up programming to the great unwashed.

Of course it can be immeasurably improved by the addition of some more characters, to wit:

{1, 2, 3, 4} // (f /@ # & ) // (g /@ # &)

But, what about my favourite?

Map[ (s \[Function] g[ f[ s ] ]), {1, 2, 3, 4} ]

Or, somewhat less attractive IMHO,

(s \[Function] g[ f[ s ] ]) /@ {1, 2, 3, 4}.

I like (s \[Function] g[ f[ s ] ])  because to me it is intuitive, to use your word. I don't have to recall the way Composition[ ] works, I just have to know what g( f( x ) ) means in mathematics, and the \[Function] arrow is at least more suggestive to me of its meaning/effect than such as // or /@ or @@ or @@@, etc. I can at least suspect that \[Function] means "goes to" or "becomes".

Barrie

PS
I've enjoyed this thread, MathGroup!

>>> On 21/03/2012 at 9:46 pm, in message <201203211046.FAA27118@smc.vnet.net>,
DrMajorBob <btreat1@austin.rr.com> wrote:
> Here SIX several equivalent expressions from (IMHO) most intuitive or  
> readable to least:
> 
> Composition[g, f] /@ {1, 2, 3, 4}
> 
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
> 
> g /@ f /@ {1, 2, 3, 4}
> 
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
> 
> Apply[Composition, {g, f}] /@ {1, 2, 3, 4}
> 
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
> 
> g@f@# & /@ {1, 2, 3, 4}
> 
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
> 
> Compose[g, f@#] & /@ {1, 2, 3, 4}
> 
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
> 
> {1, 2, 3, 4} // f /@ # & // g /@ # &
> 
> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
> 
> The last is truly awful.
> 
> Bobby
> 
> On Tue, 20 Mar 2012 02:18:47 -0500, roby <roby.nowak@gmail.com> wrote:
> 
>>> That creates a information fog that makes *all* Mathematica code harder  
>>> to understand, and Mathematica much harder to learn than it used to be.
>>
>> {1, 2, 3, 4} /// f///g
>>
>>
>>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>
>> sorry but I absolutly can't agree with your opinion in this case, the
>> former expression is more or less fogless and would be much easier to
>> understand.
>> The latter expression bears a lot of clutter.
>>
>> Robert
>>
>>
>>
> 

[toc] | [prev] | [next] | [standalone]


#9207

Fromroby <roby.nowak@gmail.com>
Date2012-03-23 06:33 +0000
Message-ID<jkh5fl$jse$1@smc.vnet.net>
In reply to#9200
Hi Berry,

the original posting topic was about a nice to have postfix operator.

your favorit:

s \[Function] g[ f[ s ] ]

is a realy nice notation for pure functions instead of #& or
Function[ ]

but it does not address the original topic.


please dont hijack my posting

Robert

[toc] | [prev] | [next] | [standalone]


#9217

FromDrMajorBob <btreat1@austin.rr.com>
Date2012-03-24 07:05 +0000
Message-ID<jkjrn9$43h$1@smc.vnet.net>
In reply to#9017
I'd still have to go with

Composition[g, f] /@ {1, 2, 3, 4}

It's fewer keystrokes and emphasizes that you're composing one function  
with another, and it's not hard to the right to left convention we've  
ALWAYS used in math.

Bobby

On Wed, 21 Mar 2012 17:53:12 -0500, Barrie Stokes  
<Barrie.Stokes@newcastle.edu.au> wrote:

> Hi Bobby
>
> I agree with your sentiments.  The folk who like {1, 2, 3, 4} // f /@ #  
> & // g /@ # & are those who regret the passing of assembly coding by  
> hand, which opened up programming to the great unwashed.
>
> Of course it can be immeasurably improved by the addition of some more  
> characters, to wit:
>
> {1, 2, 3, 4} // (f /@ # & ) // (g /@ # &)
>
> But, what about my favourite?
>
> Map[ (s \[Function] g[ f[ s ] ]), {1, 2, 3, 4} ]
>
> Or, somewhat less attractive IMHO,
>
> (s \[Function] g[ f[ s ] ]) /@ {1, 2, 3, 4}.
>
> I like (s \[Function] g[ f[ s ] ])  because to me it is intuitive, to  
> use your word. I don't have to recall the way Composition[ ] works, I  
> just have to know what g( f( x ) ) means in mathematics, and the  
> \[Function] arrow is at least more suggestive to me of its  
> meaning/effect than such as // or /@ or @@ or @@@, etc. I can at least  
> suspect that \[Function] means "goes to" or "becomes".
>
> Barrie
>
> PS
> I've enjoyed this thread, MathGroup!
>
>>>> On 21/03/2012 at 9:46 pm, in message  
>>>> <201203211046.FAA27118@smc.vnet.net>,
> DrMajorBob <btreat1@austin.rr.com> wrote:
>> Here SIX several equivalent expressions from (IMHO) most intuitive or
>> readable to least:
>>
>> Composition[g, f] /@ {1, 2, 3, 4}
>>
>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>
>> g /@ f /@ {1, 2, 3, 4}
>>
>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>
>> Apply[Composition, {g, f}] /@ {1, 2, 3, 4}
>>
>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>
>> g@f@# & /@ {1, 2, 3, 4}
>>
>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>
>> Compose[g, f@#] & /@ {1, 2, 3, 4}
>>
>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>
>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>
>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>
>> The last is truly awful.
>>
>> Bobby
>>
>> On Tue, 20 Mar 2012 02:18:47 -0500, roby <roby.nowak@gmail.com> wrote:
>>
>>>> That creates a information fog that makes *all* Mathematica code  
>>>> harder
>>>> to understand, and Mathematica much harder to learn than it used to  
>>>> be.
>>>
>>> {1, 2, 3, 4} /// f///g
>>>
>>>
>>>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>>
>>> sorry but I absolutly can't agree with your opinion in this case, the
>>> former expression is more or less fogless and would be much easier to
>>> understand.
>>> The latter expression bears a lot of clutter.
>>>
>>> Robert
>>>
>>>
>>>
>>
>


-- 
DrMajorBob@yahoo.com

[toc] | [prev] | [next] | [standalone]


#9227

FromRay Koopman <koopman@sfu.ca>
Date2012-03-25 05:15 +0000
Message-ID<jkm9m2$btr$1@smc.vnet.net>
In reply to#9217
I vote for

  g /@ f /@ {1, 2, 3, 4}

It's cleaner.

On Mar 24, 12:05 am, DrMajorBob <btre...@austin.rr.com> wrote:
> I'd still have to go with
>
> Composition[g, f] /@ {1, 2, 3, 4}
>
> It's fewer keystrokes and emphasizes that you're composing one function
> with another, and it's not hard to the right to left convention we've
> ALWAYS used in math.
>
> Bobby
>
> On Wed, 21 Mar 2012 17:53:12 -0500, Barrie Stokes
>
> <Barrie.Sto...@newcastle.edu.au> wrote:
>> Hi Bobby
>>
>> I agree with your sentiments.  The folk who like {1, 2, 3, 4} // f /@ #
>> & // g /@ # & are those who regret the passing of assembly coding by
>> hand, which opened up programming to the great unwashed.
>>
>> Of course it can be immeasurably improved by the addition of some more
>> characters, to wit:
>>
>> {1, 2, 3, 4} // (f /@ # & ) // (g /@ # &)
>>
>> But, what about my favourite?
>>
>> Map[ (s \[Function] g[ f[ s ] ]), {1, 2, 3, 4} ]
>>
>> Or, somewhat less attractive IMHO,
>>
>> (s \[Function] g[ f[ s ] ]) /@ {1, 2, 3, 4}.
>>
>> I like (s \[Function] g[ f[ s ] ])  because to me it is intuitive, to
>> use your word. I don't have to recall the way Composition[ ] works, I
>> just have to know what g( f( x ) ) means in mathematics, and the
>> \[Function] arrow is at least more suggestive to me of its
>> meaning/effect than such as // or /@ or @@ or @@@, etc. I can at least
>> suspect that \[Function] means "goes to" or "becomes".
>>
>> Barrie
>>
>> PS
>> I've enjoyed this thread, MathGroup!
>>
>>>>> On 21/03/2012 at 9:46 pm, in message
>>>>> <201203211046.FAA27...@smc.vnet.net>,
>> DrMajorBob <btre...@austin.rr.com> wrote:
>>> Here SIX several equivalent expressions from (IMHO) most intuitive or
>>> readable to least:
>>>
>>> Composition[g, f] /@ {1, 2, 3, 4}
>>>
>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>
>>> g /@ f /@ {1, 2, 3, 4}
>>>
>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>
>>> Apply[Composition, {g, f}] /@ {1, 2, 3, 4}
>>>
>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>
>>> g@f@# & /@ {1, 2, 3, 4}
>>>
>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>
>>> Compose[g, f@#] & /@ {1, 2, 3, 4}
>>>
>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>
>>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>>
>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>
>>> The last is truly awful.
>>>
>>> Bobby
>>>
>>> On Tue, 20 Mar 2012 02:18:47 -0500, roby <roby.no...@gmail.com> wrote:
>>>
>>>>> That creates a information fog that makes *all* Mathematica code
>>>>> harder
>>>>> to understand, and Mathematica much harder to learn than it used to
>>>>> be.
>>>>
>>>> {1, 2, 3, 4} /// f///g
>>>>
>>>>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>>>
>>>> sorry but I absolutly can't agree with your opinion in this case, the
>>>> former expression is more or less fogless and would be much easier to
>>>> understand.
>>>> The latter expression bears a lot of clutter.
>
>>>> Robert
>
> --
> DrMajor...@yahoo.com

[toc] | [prev] | [next] | [standalone]


#9239

FromBarrie Stokes <Barrie.Stokes@newcastle.edu.au>
Date2012-03-26 06:51 +0000
Message-ID<jkp3ku$l0b$1@smc.vnet.net>
In reply to#9017
I agree.

If you want to use some of the same characters that denote swearing in comic books (or did when I read comics), g /@ f /@ {1, 2, 3, 4} is pretty clean an unambiguous.

Barrie

>>> On 25/03/2012 at 4:15 pm, in message <201203250515.AAA12207@smc.vnet.net>, Ray
Koopman <koopman@sfu.ca> wrote:
> I vote for
> 
>   g /@ f /@ {1, 2, 3, 4}
> 
> It's cleaner.
> 
> On Mar 24, 12:05 am, DrMajorBob <btre...@austin.rr.com> wrote:
>> I'd still have to go with
>>
>> Composition[g, f] /@ {1, 2, 3, 4}
>>
>> It's fewer keystrokes and emphasizes that you're composing one function
>> with another, and it's not hard to the right to left convention we've
>> ALWAYS used in math.
>>
>> Bobby
>>
>> On Wed, 21 Mar 2012 17:53:12 -0500, Barrie Stokes
>>
>> <Barrie.Sto...@newcastle.edu.au> wrote:
>>> Hi Bobby
>>>
>>> I agree with your sentiments.  The folk who like {1, 2, 3, 4} // f /@ #
>>> & // g /@ # & are those who regret the passing of assembly coding by
>>> hand, which opened up programming to the great unwashed.
>>>
>>> Of course it can be immeasurably improved by the addition of some more
>>> characters, to wit:
>>>
>>> {1, 2, 3, 4} // (f /@ # & ) // (g /@ # &)
>>>
>>> But, what about my favourite?
>>>
>>> Map[ (s \[Function] g[ f[ s ] ]), {1, 2, 3, 4} ]
>>>
>>> Or, somewhat less attractive IMHO,
>>>
>>> (s \[Function] g[ f[ s ] ]) /@ {1, 2, 3, 4}.
>>>
>>> I like (s \[Function] g[ f[ s ] ])  because to me it is intuitive, to
>>> use your word. I don't have to recall the way Composition[ ] works, I
>>> just have to know what g( f( x ) ) means in mathematics, and the
>>> \[Function] arrow is at least more suggestive to me of its
>>> meaning/effect than such as // or /@ or @@ or @@@, etc. I can at least
>>> suspect that \[Function] means "goes to" or "becomes".
>>>
>>> Barrie
>>>
>>> PS
>>> I've enjoyed this thread, MathGroup!
>>>
>>>>>> On 21/03/2012 at 9:46 pm, in message
>>>>>> <201203211046.FAA27...@smc.vnet.net>,
>>> DrMajorBob <btre...@austin.rr.com> wrote:
>>>> Here SIX several equivalent expressions from (IMHO) most intuitive or
>>>> readable to least:
>>>>
>>>> Composition[g, f] /@ {1, 2, 3, 4}
>>>>
>>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>>
>>>> g /@ f /@ {1, 2, 3, 4}
>>>>
>>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>>
>>>> Apply[Composition, {g, f}] /@ {1, 2, 3, 4}
>>>>
>>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>>
>>>> g@f@# & /@ {1, 2, 3, 4}
>>>>
>>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>>
>>>> Compose[g, f@#] & /@ {1, 2, 3, 4}
>>>>
>>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>>
>>>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>>>
>>>> {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>>>>
>>>> The last is truly awful.
>>>>
>>>> Bobby
>>>>
>>>> On Tue, 20 Mar 2012 02:18:47 -0500, roby <roby.no...@gmail.com> wrote:
>>>>
>>>>>> That creates a information fog that makes *all* Mathematica code
>>>>>> harder
>>>>>> to understand, and Mathematica much harder to learn than it used to
>>>>>> be.
>>>>>
>>>>> {1, 2, 3, 4} /// f///g
>>>>>
>>>>>> {1, 2, 3, 4} // f /@ # & // g /@ # &
>>>>>
>>>>> sorry but I absolutly can't agree with your opinion in this case, the
>>>>> former expression is more or less fogless and would be much easier to
>>>>> understand.
>>>>> The latter expression bears a lot of clutter.
>>
>>>>> Robert
>>
>> --
>> DrMajor...@yahoo.com

[toc] | [prev] | [next] | [standalone]


#9255

Fromroby <roby.nowak@gmail.com>
Date2012-03-28 09:57 +0000
Message-ID<jkun9l$ami$1@smc.vnet.net>
In reply to#9239
Well, here I have an "almost perfect" postfix solution. Enjoy.

In[11]:=     "}4,3,2,1{@/soC@/niS@/naT" // StringReverse //
ToExpression

Out[11]=     {Tan[Sin[Cos[1]]], Tan[Sin[Cos[2]]], Tan[Sin[Cos[3]]],
Tan[Sin[Cos[4]]]}

Robert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web