Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » hash tables » override
next | previous | forward | backward | up | index | toc

# override -- override default values for optional arguments

## Description

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 OptionTable from { a => 1, b => 2 };

    i2 : override(defs, (4,b=>6,5))

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

    o2 : Sequence

## For the programmer

The object override is a compiled function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/override-doc.m2:31:0.