MathGroup Archive 2012

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

Search the Archive

Re: new functional operator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125663] Re: new functional operator
  • From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
  • Date: Mon, 26 Mar 2012 01:48:44 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jjfd6e$7u7$1@smc.vnet.net> <jjpakk$ov1$1@smc.vnet.net>

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 at smc.vnet.net>, Ray
Koopman <koopman at sfu.ca> wrote:
> I vote for
> 
>   g /@ f /@ {1, 2, 3, 4}
> 
> It's cleaner.
> 
> On Mar 24, 12:05 am, DrMajorBob <btre... at 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... at 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... at smc.vnet.net>,
>>> DrMajorBob <btre... at 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... at 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... at yahoo.com




  • Prev by Date: Re: Exporting a formula to Excel via copypaste
  • Next by Date: Re: Compiling Runge-kutta
  • Previous by thread: Re: new functional operator
  • Next by thread: Re: new functional operator