MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: new functional operator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125340] Re: new functional operator
  • From: roby <roby.nowak at gmail.com>
  • Date: Thu, 8 Mar 2012 04:36:32 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jit0me$e32$1@smc.vnet.net> <jivd47$n7j$1@smc.vnet.net>

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
> > forMap[ ].
>
> How about:
>
> 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)

Yes,

THIS IS IT

surprisingly easy, surprisingly not yet standard in Mathematica

can even be prettyfied a little bit:

RightVector[a_,f_]:=f/@a
RightVector[a_,more__]:=RightVector[First@{more}/
@a,Sequence@@Rest@{more}]

or we can use LeftTee[ ] which in contrast to RightArrow[ ] already
implements the neccesary left-assocciativitiy such that:

LeftTee[a_, f_] := f /@ a

is all we need.


{1,2,3}\[LeftTee]Sin\[LeftTee]Sqrt
(looks nicer in a notebook)


Robert



  • Prev by Date: Re: new functional operator
  • Next by Date: Re: much power to mathematica
  • Previous by thread: Re: new functional operator
  • Next by thread: Re: new functional operator