Re: new functional operator
- To: mathgroup at smc.vnet.net
- Subject: [mg125608] Re: new functional operator
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Wed, 21 Mar 2012 05:46:51 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jjfd6e$7u7$1@smc.vnet.net> <jjpakk$ov1$1@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
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 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
>
>
>
--
DrMajorBob at yahoo.com