MathGroup Archive 2012

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

Search the Archive

Re: new functional operator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126747] Re: new functional operator
  • From: Rui <rui.rojo at gmail.com>
  • Date: Sun, 3 Jun 2012 05:03:32 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jjfd6e$7u7$1@smc.vnet.net> <jjpakk$ov1$1@smc.vnet.net>

Composition, mapping twice... They are all nice, but the original question was clearly of someone that likes the flow of postfix. You do this, then you do that, then you do that and finally you do that. So the typing needs to be in that order.

I'd suggest keeping // as the "postfix application" operator. /// would have been nice since it's similar to //. Most other options won't have the appropriate precedence, so you'll be parenthesising everything.
So, you could do an underscripted // (underscripted by "/@", or by "{}", to have the "map application". For example

MakeExpression[ RowBox[{l_, UnderscriptBox["//", RowBox[{"{", "}"}]], r_}], form : StandardForm] := MakeExpression[RowBox[{r, "/@", l}], form]

Now you use an // underscripted by {} as a map application. If you want to share the code, you can turn it into standard form by selecting the cell, Convert To, and it becomes a regular prefix map

On Wednesday, March 28, 2012 6:57:09 AM UTC-3, roby wrote:
> Well, here I have an "almost perfect" postfix solution. Enjoy.
> 
> In[11]:=     "}4,3,2,1{@/soC@/niS@/naT" // StringReverse //
> ToExpression
> 
> Out[11]=     {Tan[Sin[Cos[1]]], Tan[Sin[Cos[2]]], Tan[Sin[Cos[3]]],
> Tan[Sin[Cos[4]]]}
> 
> Robert




  • Prev by Date: Re: Sum of Products
  • Next by Date: Re: Memory Blowup Issues
  • Previous by thread: Re: new functional operator
  • Next by thread: Conditionals for lookup table