Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » lists and sequences » BasicList » Option
next | previous | forward | backward | up | index | toc

Option -- the class of all key-value pairs K => V

Description

Such pairs are used as optional arguments for functions.

i1 : o = Limit => 5

o1 = Limit => 5

o1 : Option
i2 : peek o

o2 = Option{Limit, 5}

There is also a way to make new hash tables from lists of key-value pairs.

i3 : ht = new HashTable from {a => 5, b => 7}

o3 = HashTable{a => 5}
               b => 7

o3 : HashTable
i4 : keys ht

o4 = {a, b}

o4 : List
i5 : values ht

o5 = {5, 7}

o5 : List
i6 : pairs ht

o6 = {(a, 5), (b, 7)}

o6 : List

These pairs are implemented as lists, so that if z is x => y, then x is z#0 and y is z#1.

i7 : o#0

o7 = Limit

o7 : Symbol
i8 : o#1

o8 = 5

See also

Menu

Functions and methods returning an option:

  • Thing => Thing -- see => -- construct an option

Methods that use an option:

  • directSum(Option) -- see directSum -- direct sum of modules or maps
  • Option ++ Option -- see directSum -- direct sum of modules or maps
  • installAssignmentMethod(Symbol,HashTable,HashTable,Option) -- see installing assignment methods -- install methods assignment to the value of an operator
  • installAssignmentMethod(Symbol,HashTable,Option) -- see installing assignment methods -- install methods assignment to the value of an operator
  • package(Option) -- see package -- get containing package
  • substitute(Ideal,Option) -- see substitute -- substituting values for variables
  • substitute(Matrix,Option) -- see substitute -- substituting values for variables
  • substitute(Module,Option) -- see substitute -- substituting values for variables
  • substitute(RingElement,Option) -- see substitute -- substituting values for variables
  • substitute(Vector,Option) -- see substitute -- substituting values for variables

For the programmer

The object Option is a type, with ancestor classes BasicList < Thing.


The source of this document is in Macaulay2Doc/functions/options-doc.m2:88:0.