Re: new functional operator

• To: mathgroup at smc.vnet.net
• Subject: [mg125367] Re: new functional operator
• From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
• Date: Sat, 10 Mar 2012 06:14:29 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <jit0me\$e32\$1@smc.vnet.net> <jivd47\$n7j\$1@smc.vnet.net>

```Hi Robert

Nice!

But for even greater elegance, IMHO, how about

In[277]:= {a, b, c} \[RightVector] (s \[Function] s^2)

Out[277]= {a^2, b^2, c^2}

Cheers

Barrie

>>> On 08/03/2012 at 8:39 pm, in message <201203080939.EAA14205 at smc.vnet.net>, roby
<roby.nowak at gmail.com> wrote:
> On 4 Mrz., 10:37, noqsiaerosp... at gmail.com wrote:
>> On Saturday, March 3, 2012 8:52:46 PM UTC+9, roby wrote:
>> > Dear Group and Mathematica staff.
>>
>> > In the functional programming spirit I am missing a postfix notation
>> > for Map[ ].
>>
>>
>> RightVector[a_,f_]:=Map[f, a]
>> RightVector[a_,more__]:=RightVector[Map[{more}[[1]],a],Sequence@@Drop[{more
> },1]]
>>
>> Then:
>>
>> {1,2,3}\[RightVector](#^2&)\[RightVector]g
>>
>> yields:
>>
>> {g[1],g[4],g[9]}
>>
>> (it looks nicer in a notebook)
>
> ...  sorry for flooding the group, but got it even nicer:
>
> RightVector[a_, first_, rest___] := If[rest === Null, first /@ a,
> RightVector[first /@ a, rest]]
>
> Robert

```

• Prev by Date: Re: Engineering requests
• Next by Date: Real time sound processing?
• Previous by thread: Re: new functional operator
• Next by thread: Re: new functional operator