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


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

Re: new functional operator

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

Show all headers | View raw


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