This must be a duplicate but I can't find any related post. I want to pass two arguments to a function using postfix syntax like


More generally, can somebody explain to me in better detail how I can use these kind of constructions: @f , ~~f~~, and //f


3 Answers 3


Let me start with the second question first as it is more direct. You can see for yourself how these inputs work:

f @ x
x ~f~ y
x // f
f[x, y]

The first and third only work with a single argument. Similar to but distinct from the first is @@ which is shorthand for Apply, and it allows:

f @@ {x, y}
f[x, y]

Here the Head List is replaced with f. For more clarity see: Scan vs. Map vs. Apply

With the single-argument forms you can use Sequence to insert multiple arguments, but only if the function (f) does not have the Attribute SequenceHold or HoldAllComplete:

f @ Sequence[x, y]
Sequence[x, y] // f
f[x, y]
f[x, y]

And an example of where this will not work:

Rule @ Sequence[x, y]

Rule::argr: Rule called with 1 argument; 2 arguments are expected. >>

Rule[Sequence[x, y]]

If you wish to use a multi-argument function with // application you can make it a parametrized, SubValues, or operator form function, all meaning essentially the same thing. See:

A very simple example:

f[a__][x_] := g[a, x]


y // f[x]
g[x, y]
x // f[1, 2, 3]
g[1, 2, 3, x]

See the first bulleted link above for more examples and theory.


  • 1
    $\begingroup$ Note that you can always use x // f[#, ...]& if you need to supply extra arguments like in Table[{i, 2^i}, {i, 24, 0, -1}] // TableForm[#, TableHeadings -> {None, {"i", "2^i"}}] & $\endgroup$ Feb 10, 2017 at 12:08
  • 1
    $\begingroup$ @lkuty Oh yes, that's a very useful pattern. It is mentioned in an answer to one of the questions I linked: mathematica.stackexchange.com/a/6957/121. I make use of it quite often, e.g. mathematica.stackexchange.com/a/136196/121 $\endgroup$
    – Mr.Wizard
    Feb 10, 2017 at 12:29

(Just answering the first question. Others have answered the second question thoroughly.)

It's worth mentioning that you can do

{x,y} // (f @@ #) &


(No parentheses needed, but I added them for clarity.)

You could even make your own function to do this (slightly) more compactly, especially if you have trouble remembering the @'s and #'s :

pf[ argList_, f_ ] := f @@ argList

Then you can do what you want using an infix operator:

{x,y} ~pf~ f



Lately I've taken to writing my first example above as

{x,y} // Apply[f] 


{x,y} // Apply@f

which I fine somewhat more readable, particularly when there are other pure functions involved. Note that this uses the operator form of Apply.


According to my basic understand of these notations:

For infix notation, the function must be a binary operator, e.g.

g[x_, y_] := x^2 - y^2;





For postfix notation, the function must take one argument




gives 21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.