Is it possible to use the @ symbol with multiple arguments? The Prefix command suggested not. If so, why?
|
|
|||
|
If you use
or
|
||||
|
|
|
In order to supply multiple arguments the way you intend, you should use
I hesitate to suggest this as a "supply multiple arguments" function, because all that Another important point that I forgot to mention, and Szabolcs points out below, is that this will give you different results if the function has hold attributes (another reason not to think of it as mentioned above). For example:
|
|||||||||||||||
|
|
I don't think so: you would have a lot of ambiguity as to what are the arguments. Also, how would you write the shorthand version? Lets take for example
If your other arguments don't change much you could write wrapper functions with the other arguments given. For example:
|
|||
|

f[#, 1, 2] &@x? – rm -rf♦ May 11 '12 at 7:04@@. E.g.:f @@ {x, y, z}, but that's not prefix anymore.. – rm -rf♦ May 11 '12 at 7:12@-syntax was inspired by the function composition operator which is often denoted with a circle in mathematics: $(f\circ g)(x) = f(g(x))$. It seems natural to restrict it to one argument. If you writef @ (x,y), it suggests that(x,y)stands as a unit by itself, which is not the case. Of course we can just guess why exactly multiple argument were excluded when the syntax was defined. – Szabolcs May 11 '12 at 8:01