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,...
When optional arguments are specified, the method functions installed should accept an additional argument to which will be passed a hash table of type OptionTable containing the optional argument names and their values. The 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 := (x,options) -> options.Slope * x + options.Intercept
o2 = --function--
o2 : Function
i3 = f(5.,Slope=>100)
o3 = 501.
o3 : RR
See also method.
Go to main index.
Go to concepts index.