Perhaps this is just one of those Mathematica curiosities, but I'd like to know why by default
OperatorApplied[f][x][y] === f[y,x]
versus the more usual way one would expect it to work,
OperatorApplied[f,2][x][y] === f[x,y]
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityIt comes down to being consistent with the convention/idiom/pattern of WL functions typically having as a first argument an object to be operated on with typically the second argument doing the operating. Operator forms, in contrast, most naturally take as a first argument the thing doing the operating which is therefore most commonly the original function's second argument - hence the reversal.
Well in some ways this question doesn't have a precise answer since you would need to get into the minds of WRI developers (which I don't think is a reason to close--the question's takeaway is useful IMO) but some evidence for assessing "typically" ...
While common it is not absolute e.g.
Replace
and TuringMachine
have operator forms with first argument type (rules,rule) that correspond to different positions (second, first) in the original function.
OperatorApplied
seems to be the more "practical wing" of CurryApplied
which seems to be being reserved for more fundamental work associated with combinators etc. On the other hand, the only difference between the two functions seems to be in their respective operator forms? (b.t.w. the naming with trailing Applied
's is v.nice - captures intuitively the moment of resolving).
$\endgroup$
Mar 22, 2020 at 3:02
Curry
.OperatorApplied[f][x][y] === Curry[f][x][y]
andOperatorApplied[f,2][x][y] === Curry[f,2][x][y]
$\endgroup$OperatorApplied[f, 2][x][y] === CurryApplied[f, 2][x][y]
$\endgroup$