Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
DrMajorBob

Posts: 1,448
Registered: 11/3/08
Re: new functional operator
Posted: Mar 21, 2012 6:48 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.