• To: mathgroup at smc.vnet.net
• Subject: [mg95043] Re: [mg95015] Shorthand for MapThread
• From: "Jose Luis Gomez" <jose.luis.gomez at itesm.mx>
• Date: Sun, 4 Jan 2009 07:32:49 -0500 (EST)
• References: <200901031054.FAA02709@smc.vnet.net>

```Dear Martin:

First: you can write any two-arguments command in infix notation using
arg1~command~arg2

For example, evaluate:

a~foo~b

And you will obtain foo[a,b]

Therefore, you can evaluate:

f[#1, #2] & ~MapThread~ {{a, b, c}, {d, e, f}}

And you will obtain the same result as MapThread[f[#1, #2] &,{{a, b, c}, =
{d,
e, f}}]

Second: In order to make it really convenient, you can evaluate at the

After the evaluation above, every time you write mt Mathematica will =
replace
it with MapThread, therefore you will be able to write:

f[#1, #2] & ~mt~ {{a, b, c}, {d, e, f}}

which might be short enough and fast enough for your purposes. On the =
other
hand, something like /@@ might be too complex to implement, because
Mathematica separates /@ from @ even before trying the evaluation.

Hope that helps.
Jose
Mexico

-----Mensaje original-----
De: Schettler, Martin [mailto:MSchettler at scitor.com]
Para: mathgroup at smc.vnet.net

All -

I frequently use Map and MapThread, and find Map's shorthand:

f /@ {a,b,c}

to be very convenient.

As far as I can tell, MapThread has no corresponding "infix" notation.
Can anyone tell me if it's possible (and if so, how) to make my own?
E.g.

f[#1,#2]& /@@ {{a,b,c},{d,e,f}}

Thanks!
Marty

```

• Prev by Date: Re: Fourier Transform Graph Coordinates
• Next by Date: Re: Fourier Transform Graph Coordinates