f = method(Options => w) -- creates a method which accepts optional arguments. Here 'w' is a list {A=>a,B=>b,...} of optional argument names A,B,... and corresponding default values a,b,...
The methods installed for this method function should be written in the form opts -> args -> (...). The argument args will be assigned a hash table of type OptionTable containing the optional argument names and their values. The default table will be stored in the OptionsRegistry and can be recovered with the function options.
i1 : f = method(Options => {Slope => 1, Intercept => 1}) |
i2 : f RR := o -> x -> o.Slope * x + o.Intercept |
i3 : f(5.,Slope=>100) |
i4 : options f |
Here is a complete list of symbols which are used as names of options: Algorithm, Associative, BasisElementLimit, ChangeMatrix, CodimensionLimit, CompleteIntersection, Degree, DegreeLimit, DegreeOrder, Degrees, HardDegreeLimit, Inverses, LengthLimit, Limit, MinimalGenerators, MinimalMatrix, MonomialOrder, MonomialSize, Monomials, Options, Order, PairLimit, PairsRemaining, PrimitiveElement, Projective, SingleArgumentDispatch, SkewCommutative, SortStrategy, StopBeforeComputation, StopWithMinimalGenerators, Strategy, SubringLimit, Syzygies, SyzygyLimit, SyzygyMatrix, SyzygyRows, TotalPairs, Unmixed, UseHilbertFunction, Variable, VariableBaseName, VariableOrder, Variables, Verify, WeylAlgebra.
See also method.