Options

Options -- an option used with method to specify names of optional arguments and their default values.

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})

o1 = f

o1 : Function
i2 : f RR := o -> x -> o.Slope * x + o.Intercept

o2 = --function--

o2 : Function
i3 : f(5.,Slope=>100)

o3 = 501.

o3 : RR
i4 : options f

o4 = OptionTable{Intercept => 1}
                 Slope => 1

o4 : OptionTable

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.


topindexpreviousupnext