HaloO, Mark J. Reed wrote:
Anyway, "function" vs "operator" is mostly a difference in terminology
I'm not sure what the defined difference between function and operator is in Perl 6 but I make a very clear distinction. An operator is acting an *one* type, that is &op:(::T,T-->T) while a function is a mapping of different types &f:(::S,::T-->::R). IOW, Operator does Function but not the converse. So overloading an operator with inhomogenous types should not change the abstract properties of the operator but be a convenient form to upgrade the operants.
that makes no difference in practice, but I believe it is technically the "operator"-ness of these apparent functions that allows you to call them without parentheses:
This is more about syntax than the distinction between operator and function. To me max is a commutative and associative operator. That is it could be defined in the pre-, post and infix slots. (max 1,2,3) == (1 max 2 max 3) == (1,2,3max) == (1,2,3\ max) == ([max] 1,2,3) == ((1,2,3)max) Note that (1,2,3.max) === (1,2,3 .max) === ((1,2),(3.max)) because .max tightens the precedence above that of comma and the return type becomes a list instead of a num. Regards, TSa. -- The Angel of Geometry and the Devil of Algebra fight for the soul of any mathematical being. -- Attributed to Hermann Weyl