next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: override

override -- override default values for optional arguments


override(defaults,args) overrides default values for optional arguments present in the argument sequence args.

One possibility is for the argument defaults to be an immutable hash table (of type OptionTable), and args should be a sequence of arguments, some of which are optional arguments of the form x => v. Each such optional argument is removed from args, and the value in defaults corresponding to the key x is replaced by v. The value returned is the modified pair (defaults, args). An error is signalled if the key x does not occur in defaults.

A second possibility is for the argument defaults to be null, in which case the keys x are not checked for validity, and no default values are provided. The main use of this is to separate the optional arguments from the other arguments, which can then be used for dispatching to the correct method.

This function is intended for internal use only, and is used in the processing of optional arguments for method functions that accept them.

i1 : defs = new HashTable from { a => 1, b => 2 };
i2 : override(defs, (4,b=>6,5))

o2 = (HashTable{a => 1}, (4, 5))
                b => 6

o2 : Sequence

For the programmer

The object override is a compiled function.