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


Groups > comp.soft-sys.math.mathematica > #9217

Re: new functional operator

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: new functional operator
Date 2012-03-24 07:05 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jkjrn9$43h$1@smc.vnet.net> (permalink)
References <jjfd6e$7u7$1@smc.vnet.net> <jjpakk$ov1$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web