Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Topic: new functional operator
Replies: 27   Last Post: Jun 3, 2012 5:05 AM

 Messages: [ Previous | Next ]
 Barrie Stokes Posts: 86 Registered: 1/21/10
Re: new functional operator
Posted: Mar 26, 2012 2:51 AM

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
>>>>
>>>> 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

Date Subject Author
3/3/12 roby.nowak@gmail.com
3/4/12 Noqsi
3/8/12 roby.nowak@gmail.com
3/8/12 roby.nowak@gmail.com
3/8/12 roby.nowak@gmail.com
3/9/12 roby.nowak@gmail.com
3/10/12 Murray Eisenberg
3/22/12 Bill Rowe
3/10/12 Barrie Stokes
3/10/12 Barrie Stokes
3/13/12 roby.nowak@gmail.com
3/8/12 branton.campbell
3/10/12 Bill Rowe
3/14/12 roby.nowak@gmail.com
3/18/12 Noqsi
3/20/12 roby.nowak@gmail.com
3/21/12 Noqsi
3/21/12 DrMajorBob
3/22/12 roby.nowak@gmail.com
3/22/12 Barrie Stokes
3/23/12 roby.nowak@gmail.com
3/24/12 DrMajorBob
3/25/12 Ray Koopman
3/26/12 Barrie Stokes
3/28/12 roby.nowak@gmail.com
6/3/12 Rui
6/3/12 Rui