ClassArgument

ClassArgument -- an option name for method which allows one argument to the method function to be interpreted as a class in its own right.

f = method(ClassArgument => {false,true}) -- provides a list of boolean values, the n-th of which specifies whether the n-th argument presented to the the method function, rather than its class, will participate in the search for a method function.

The code above creates a function named 'f' which takes up to three arguments, looking up the appropriate method according to its arguments, with inheritance. To install a method for two arguments, (x,Y), where x is of class X, 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.

We give two examples for contrast.

     i1 = f = method ();
     
     i2 = f(ZZ,QQ) := print;
     
     i3 = f(3,3/2)
     
       3
     3,-
       2
The method function used above was effectively found as the value of lookup(f,class 3, class 3/2) .
     i4 = g = method (ClassArgument => {false,true});
     
     i5 = g(ZZ,QQ) := print;
     
     i6 = g(3,QQ)
     
     3,QQ
The method function used above was effectively found as the value of lookup(f,class 3, QQ) . Notice that QQ , the second argument, participated directly, rather than its class.

This option is incompatible with the Associativeoption, and hasn't yet been implemented in conjunction with the Options option.

See also method.

Go to main index.

Go to concepts index.