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

List -- the class of all lists -- {...}

Description

Lists in Macaulay2 consist of elements of any type, enclosed in braces, and separated by commas.
i1 : L = {a,1,b,2}

o1 = {a, 1, b, 2}

o1 : List
The length of a list has two notations, the version with the # is faster when writing programs.
i2 : #L, length L

o2 = (4, 4)

o2 : Sequence
The first entry of the list has index 0. Indexing is performed using #.
i3 : L#2

o3 = b

o3 : Symbol

Lists in Macaulay2 are immutable. See MutableList for making and using lists that you may modify.

To convert lists to and from other types of BasicList, in addition to toList, one may use new.

i4 : new Array from {a,b,c}

o4 = [a, b, c]

o4 : Array
i5 : new List from [a,b,c]

o5 = {a, b, c}

o5 : List

For an overview of lists and sequences, see lists and sequences.

Menu

Types of list:

  • VerticalList -- a type of visible self-initializing list that prints vertically

Functions and methods returning a list:

  • List * Thing -- see * -- a binary operator, usually used for multiplication
  • Thing * List -- see * -- a binary operator, usually used for multiplication
  • - List -- see - -- a unary or binary operator, usually used for negation or subtraction
  • List // Number -- see // -- a binary operator, usually used for quotient
  • List // RingElement -- see // -- a binary operator, usually used for quotient
  • apply(ZZ,Function) -- apply a function to {0,..., n-1}
  • applyPairs(BasicList,Function) -- see applyPairs -- apply a function to each pair in a hash table
  • applyPairs(Dictionary,Function) -- see applyPairs -- apply a function to each pair in a hash table
  • between(Thing,VisibleList) -- see between -- insert something between elements of a list
  • commonest -- the most common elements of a list or tally
  • compositions -- list the compositions of an integer
  • decompose(Ideal)
  • degree(Matrix) (missing documentation)
  • degrees -- degrees of generators
  • elements(Set) -- see elements -- list of elements
  • findHeft -- find a heft vector for a list of degrees
  • frames(CompiledFunction) -- see frames -- get the frames associated to a closure
  • frames(CompiledFunctionClosure) -- see frames -- get the frames associated to a closure
  • frames(FunctionClosure) -- see frames -- get the frames associated to a closure
  • frames(PseudocodeClosure) -- see frames -- get the frames associated to a closure
  • frames(Sequence) -- see frames -- get the frames associated to a closure
  • frames(Symbol) -- see frames -- get the frames associated to a closure
  • Monoid _* -- see generators of rings, ideals, and modules
  • Function \ Ideal -- see Ideal / Function -- apply a function to generators of an ideal
  • Ideal / Function -- apply a function to generators of an ideal
  • independentSets(Ideal) -- see independentSets -- some size-maximal independent subsets of variables modulo an ideal
  • independentSets(MonomialIdeal) -- see independentSets -- some size-maximal independent subsets of variables modulo an ideal
  • keys(Database) -- see keys -- keys used in a hash table, dictionary, or database
  • keys(Dictionary) -- see keys -- keys used in a hash table, dictionary, or database
  • keys(HashTable) -- see keys -- keys used in a hash table, dictionary, or database
  • leadComponent(Matrix) -- see leadComponent -- the leading component(s) of a vector or matrix
  • lines(String) -- see lines -- split a string into lines
  • lines(String,String) -- see lines -- split a string into lines
  • List ** List -- Cartesian product of two lists
  • List + List -- sum of two vectors
  • List - List -- difference of two vectors
  • List | List -- join lists, sequences or arrays
  • localDictionaries(Dictionary) -- see localDictionaries -- get local dictionaries
  • localDictionaries(FunctionClosure) -- see localDictionaries -- get local dictionaries
  • localDictionaries(PseudocodeClosure) -- see localDictionaries -- get local dictionaries
  • localDictionaries(Symbol) -- see localDictionaries -- get local dictionaries
  • localDictionaries(CompiledFunction) (missing documentation)
  • localDictionaries(CompiledFunctionClosure) (missing documentation)
  • localDictionaries(Sequence) (missing documentation)
  • locate(List) -- see locate -- locate source code
  • List / Number -- see Matrix / Number -- scalar division
  • List / RingElement -- see Matrix / Number -- scalar division
  • mingle(BasicList) -- see mingle -- mingle elements of several lists
  • pack(BasicList,ZZ) -- see pack -- pack elements of a list or string into several shorter lists or strings
  • pack(String,ZZ) -- see pack -- pack elements of a list or string into several shorter lists or strings
  • pack(ZZ,BasicList) -- see pack -- pack elements of a list or string into several shorter lists or strings
  • pack(ZZ,String) -- see pack -- pack elements of a list or string into several shorter lists or strings
  • pairs(BasicList) -- see pairs -- list the pairs in a hash table, dictionary, or basic list
  • pairs(Dictionary) -- see pairs -- list the pairs in a hash table, dictionary, or basic list
  • pairs(HashTable) -- see pairs -- list the pairs in a hash table, dictionary, or basic list
  • partitions -- list the partitions of an integer
  • permutations(ZZ) -- see permutations -- produce all permutations of a list
  • positions -- which elements of a list satisfy a condition
  • regex -- evaluate a regular expression search
  • searchPath(List,String) -- search a path for a file
  • searchPath(String) -- see searchPath(List,String) -- search a path for a file
  • select(String,String) -- see select(String,String,String) -- select and reformat substrings matching a regular expression
  • select(String,String,String) -- select and reformat substrings matching a regular expression
  • select(ZZ,Function) -- select integers
  • selectPairs(BasicList,Function) -- see selectPairs -- select a part of a hash table by pairs
  • selectPairs(ZZ,BasicList,Function) -- see selectPairs -- select a part of a hash table by pairs
  • separate -- split a string into substrings using a regular expression
  • List - Set -- see Set - Set -- set difference
  • subsets -- produce the subsets of a set or list
  • take(Thing,List) -- see take -- take some elements from a list or sequence
  • take(Thing,ZZ) -- see take -- take some elements from a list or sequence
  • toList(BasicList) -- see toList -- create a list
  • toList(Set) -- see toList -- create a list
  • toList(String) -- see toList -- create a list
  • toList(Pseudocode) (missing documentation)
  • transpose(List) -- see transpose -- transpose a matrix or table
  • unique -- eliminate duplicates from a list
  • unstack(Net) -- see unstack -- list the rows of a net
  • unstack(String) -- see unstack -- list the rows of a net
  • values(Dictionary) -- see values -- values in a hash table
  • values(HashTable) -- see values -- values in a hash table
  • List / Command -- see VisibleList / Function -- apply a function to elements of a list
  • List / Function -- see VisibleList / Function -- apply a function to elements of a list

Methods that use a list:

  • # List -- length or cardinality of a list, hash table, dictionary, set, or string
  • List #? ZZ -- see #? -- check existence of value in a list, hash table, database, or string
  • >= List
  • List ? List -- see ? -- comparison operator
  • basis(InfiniteNumber,List,Ideal) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(InfiniteNumber,List,Matrix) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(InfiniteNumber,List,Module) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(InfiniteNumber,List,Ring) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,Ideal) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,InfiniteNumber,Ideal) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,InfiniteNumber,Matrix) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,InfiniteNumber,Module) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,InfiniteNumber,Ring) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,List,Ideal) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,List,Matrix) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,List,Module) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,List,Ring) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,Matrix) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,Module) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,Ring) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,RingMap) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,ZZ,Ideal) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,ZZ,Matrix) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,ZZ,Module) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(List,ZZ,Ring) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(ZZ,List,Ideal) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(ZZ,List,Matrix) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(ZZ,List,Module) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • basis(ZZ,List,Ring) -- see basis -- basis or generating set of all or part of a ring, ideal or module
  • capture(List) -- see capture -- evaluate Macaulay2 code and capture the output
  • check(List) -- see check -- perform tests of a package
  • check(List,Package) -- see check -- perform tests of a package
  • check(List,String) -- see check -- perform tests of a package
  • code(List) -- see code -- display source code
  • columnPermute(MutableMatrix,ZZ,List) -- see columnPermute -- permute some columns
  • commonRing(List) -- see commonRing -- find smallest containing ring
  • degreesMonoid(List) -- see degreesRing(List) -- the ring or monoid of degrees
  • degreesRing(List) -- the ring or monoid of degrees
  • diagonalMatrix(List) -- see diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list
  • diagonalMatrix(Ring,List) -- see diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list
  • diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list
  • diagonalMatrix(RingFamily,List) -- see diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list
  • diagonalMatrix(RingFamily,ZZ,ZZ,List) -- see diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list
  • diagonalMatrix(ZZ,ZZ,List) -- see diagonalMatrix(Ring,ZZ,ZZ,List) -- make a diagonal matrix from a list
  • directProduct(List) -- see directProduct -- direct product
  • directSum(List) -- see directSum -- direct sum of modules or maps
  • document(List) -- see document -- create a documentation node
  • makeDocumentTag(List) -- see DocumentTag -- the class of all document tags
  • drop(BasicList,List) -- see drop -- drop some elements from a list or sequence
  • dual(MonomialIdeal,List) -- the Alexander dual
  • examples(List) -- see examples -- list the examples in documentation
  • export(List) -- see export -- export symbols from a package
  • exportFrom(Package,List) -- see exportFrom -- export symbols from a package's private dictionary
  • exportFrom(String,List) -- see exportFrom -- export symbols from a package's private dictionary
  • exportMutable(List) -- see exportMutable -- export mutable symbols from a package
  • findFiles(List) -- see findFiles -- find files recursively
  • findHeft(List) -- see findHeft -- find a heft vector for a list of degrees
  • findProgram(String,List) -- see findProgram -- load external program
  • gcd(List) -- see gcd -- greatest common divisor
  • Ring _ List -- see get a monomial by exponent vector -- make a monomial from a list of exponents
  • gradedModule(List)
  • HeaderType List -- see HeaderType -- a class of lists with abbreviated constructors
  • headlines(List) -- see headlines -- display a table of documentation headlines
  • help(List) -- see help -- view documentation nodes
  • hilbertFunction(List,Ideal) -- see hilbertFunction -- the Hilbert function
  • hilbertFunction(List,Module) -- see hilbertFunction -- the Hilbert function
  • hilbertFunction(List,Ring) -- see hilbertFunction -- the Hilbert function
  • homogenize(Matrix,RingElement,List) -- see homogenize -- homogenize with respect to a variable
  • homogenize(Module,RingElement,List) -- see homogenize -- homogenize with respect to a variable
  • homogenize(RingElement,RingElement,List) -- see homogenize -- homogenize with respect to a variable
  • homogenize(Vector,RingElement,List) -- see homogenize -- homogenize with respect to a variable
  • hooks(List) -- see hooks -- list hooks attached to a key
  • ideal(List) -- make an ideal
  • importFrom(Package,List) -- see importFrom -- import symbols to the current private dictionary
  • importFrom(String,List) -- see importFrom -- import symbols to the current private dictionary
  • intersect(List) -- see intersect -- compute an intersection
  • lcm(List) -- see lcm -- least common multiple
  • List # ZZ -- get value from list, hash table, database, dictionary, or string
  • List .. List -- rectangular sequences of consecutive lists and sequences
  • List ..< List -- rectangular sequences of consecutive lists and sequences
  • List << List -- component-wise comparison of lists
  • List ^ List (missing documentation)
  • listSymbols(List) -- see listSymbols -- compact display of symbols and their values
  • makePackageIndex(List) -- see makePackageIndex -- create an index of installed packages
  • map(Module,Module,List) -- create a matrix by giving a sparse or dense list of entries
  • map(Module,Module,RingMap,List) -- see map(Module,Module,RingMap,Matrix) -- homomorphism of modules over different rings
  • map(Module,Nothing,RingMap,List) -- see map(Module,Module,RingMap,Matrix) -- homomorphism of modules over different rings
  • map(Module,Nothing,List) -- create a matrix by giving a doubly nested list of ring elements
  • map(Module,ZZ,List) -- create a matrix by giving a sparse or dense list of entries
  • map(Ring,Ring,List) -- make a ring map
  • match(List,String) -- see match -- regular expression matching
  • Matrix ^ List -- select rows
  • MutableMatrix ^ List -- see Matrix ^ List -- select rows
  • Vector ^ List -- see Matrix ^ List -- select rows
  • Matrix _ List -- select columns
  • MutableMatrix _ List -- see Matrix _ List -- select columns
  • matrix(List) -- create a matrix from a doubly-nested list of ring elements or matrices
  • matrix(Ring,List) -- create a matrix from a doubly nested list of ring elements or matrices
  • matrix(RingFamily,List) -- see matrix(Ring,List) -- create a matrix from a doubly nested list of ring elements or matrices
  • memoize(Function,List) -- see memoize -- record results of function evaluation for future use
  • Module / List -- see Module / Module -- quotient module
  • Module ^ List -- projection onto summand
  • Ideal _ List -- see Module _ List -- map from free module to some generators
  • Module _ List -- map from free module to some generators
  • monoid(List) -- see monoid -- make or retrieve a monoid
  • monomialIdeal(List) -- see monomialIdeal(Matrix) -- monomial ideal of lead monomials
  • MultigradedBettiTally List (missing documentation)
  • mutableMatrix(List) -- see mutableMatrix -- make a mutable matrix
  • mutableMatrix(Ring,List) -- see mutableMatrix -- make a mutable matrix
  • mutableMatrix(RingFamily,List) -- see mutableMatrix -- make a mutable matrix
  • new HashTable from List -- make a hash table from a list
  • new OptionTable from List (missing documentation)
  • norm(List) -- see norm
  • ofClass(List) -- see ofClass -- English phrases for types
  • options(List) -- see options(Function) -- get the optional arguments and default values of a function or method
  • OptionTable ++ List -- see OptionTable ++ OptionTable
  • List >> Function -- see OptionTable >> Function -- attaching options to a function
  • part(List,RingElement) -- see part -- select terms of a polynomial by degree(s) or weight(s)
  • part(List,Ideal) (missing documentation)
  • part(List,Matrix) (missing documentation)
  • part(List,Module) (missing documentation)
  • part(List,Ring) (missing documentation)
  • product(List) -- product of elements
  • pullback(List) (missing documentation)
  • pushout(List) (missing documentation)
  • random(List) -- shuffle a list randomly
  • random(List,Module) -- get a random vector in the module
  • random(List,Ideal) -- see random(ZZ,Ideal) -- get a random homogeneous element from a graded ideal
  • random(List,Ring) -- see random(ZZ,Ring) -- get a random homogeneous element from a graded ring
  • Ring / List -- see Ring / Ideal -- make a quotient ring
  • Ring ^ List -- make a free module
  • RingFamily ^ List -- see Ring ^ List -- make a free module
  • InexactFieldFamily List -- see Ring List -- make a local polynomial ring
  • Ring List -- make a local polynomial ring
  • rowPermute(MutableMatrix,ZZ,List) -- see rowPermute -- permute some rows
  • rsort(List) -- see rsort -- sort a list or matrix in reverse order
  • rsort(List,Function) -- see rsort -- sort a list or matrix in reverse order
  • scanLines(Function,List) -- see scanLines -- apply a function to each line of a file
  • selectVariables(List,PolynomialRing) -- see selectVariables -- make a subring of a polynomial ring generated by selected variables
  • Set - List -- see Set - Set -- set difference
  • sort(List) -- sort a list
  • sort(List,Function) -- see sort(List) -- sort a list
  • span(List) -- construct smallest interval
  • standardPairs(MonomialIdeal,List) -- see standardPairs -- find the standard pairs of a monomial ideal
  • submatrixByDegrees(Matrix,List,List) -- see submatrixByDegrees -- submatrix consisting of rows and columns in an interval or box of degrees
  • subsets(List) -- see subsets -- produce the subsets of a set or list
  • subsets(List,ZZ) -- see subsets -- produce the subsets of a set or list
  • substitute(Ideal,List) -- see substitute -- substituting values for variables
  • substitute(Matrix,List) -- see substitute -- substituting values for variables
  • substitute(Module,List) -- see substitute -- substituting values for variables
  • substitute(RingElement,List) -- see substitute -- substituting values for variables
  • substitute(Vector,List) -- see substitute -- substituting values for variables
  • sum(List) -- sum the elements of a list
  • SYNOPSIS(List) -- see SYNOPSIS -- a standardized synopsis for use in documentation nodes
  • take(BasicList,List) -- see take -- take some elements from a list or sequence
  • tensor(List) -- see tensor -- tensor product
  • truncate(List,Ideal)
  • truncate(List,List,Matrix) (missing documentation)
  • truncate(List,Matrix)
  • truncate(List,Module)
  • truncate(List,Ring)
  • truncate(Nothing,List,Matrix) (missing documentation)
  • undocumented(List) -- see undocumented -- declare that something need not be documented
  • union(List) -- see union -- compute the union
  • vars(List) -- a sequence of variables
  • vector(List) -- see vector -- make a vector
  • vector(Module,List) -- see vector -- make a vector
  • vector(Ring,List) -- see vector -- make a vector
  • vector(RingFamily,List) -- see vector -- make a vector
  • List / SelfInitializingType -- see VisibleList / Function -- apply a function to elements of a list
  • VisibleList _ List -- get some entries of a list
  • weightRange(List,RingElement) -- see weightRange -- the pair of lowest and highest weights of the monomials
  • WrapperType List -- see WrapperType -- a class of lists with abbreviated constructors

For the programmer

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


The source of this document is in Macaulay2Doc/ov_lists.m2:616:0.