f = method() -- creates a method function
The code above creates a method function which takes up to three arguments, looking up the appropriate method according to the classes of the arguments, with inheritance. To install a method for two arguments, (x,y), of classes X and Y, use code like this:
f(X,Y) := (x,y) -> ...where '...' represents the body of the function you wish to install. The syntax for one or three arguments is analogous. For a single argument x of class X, one could omit the parentheses, and write:
f X := (x) -> ...the effect of which happens to be the same as that of
X#f := (x) -> ...
See also:
Optional arguments :