# 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.

## Types of list :

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

## Functions and methods returning a list :

• Thing * List, see * -- a binary operator, usually used for multiplication
• - List -- negation of a vector
• apply(ZZ,Function) -- apply a function to {0,..., n-1}
• ascii(String) -- ASCII character conversion
• associatedPrimes -- find the associated primes of an ideal
• associatedPrimes(Ideal) -- find the associated primes of an ideal
• associatedPrimes(MonomialIdeal), see associatedPrimes(Ideal) -- find the associated primes of an ideal
• between(Thing,VisibleList) -- insert something between elements of a list
• characters(String), see characters -- get characters from a string
• commonest -- the most common elements of a list or tally
• compositions -- compositions of an integer
• degree(Matrix) (missing documentation)
• eulers -- list the sectional Euler characteristics
• List << Thing, see File << Thing -- print to a file
• findHeft -- find a heft vector for a list of degrees
• genera -- list of the successive linear sectional arithmetic genera
• icFracP(Ring), see icFracP -- compute the integral closure in prime characteristic
• Function \ Ideal, see Ideal / Function -- apply a function to generators of an ideal
• Ideal / Function -- apply a function to generators of an ideal
• irreducibleDecomposition(MonomialIdeal) -- express a monomial ideal as an intersection of irreducible monomial ideals
• keys(Database) (missing documentation)
• keys(Dictionary) (missing documentation)
• keys(HashTable) -- keys used in a hash table
• lines(String), see lines -- split a string into lines
• lines(String,String), see lines -- split a string into lines
• List % Number (missing documentation)
• List % RingElement (missing documentation)
• List + List -- sum of two vectors
• List - List -- difference of two vectors
• List / Thing -- vector division
• List // Number (missing documentation)
• List // RingElement (missing documentation)
• List | List -- join lists, sequences or arrays
• localDictionaries(Dictionary), see localDictionaries -- get local dictionaries
• localDictionaries(Function), see localDictionaries -- get local dictionaries
• localDictionaries(Pseudocode), see localDictionaries -- get local dictionaries
• localDictionaries(Symbol), see localDictionaries -- get local dictionaries
• mingle(BasicList), see mingle -- mingle elements of several lists
• pack(BasicList,ZZ), see pack -- pack elements of a list into several shorter lists
• pack(ZZ,BasicList), see pack -- pack elements of a list into several shorter lists
• pairs(BasicList) -- list the pairs in a sequence or list
• pairs(Dictionary) -- list the pairs in a dictionary
• pairs(HashTable) -- list the pairs in a hash table
• partitions(ZZ) -- list the partitions of an integer
• partitions(ZZ,ZZ) -- list the partitions of an integer
• permutations(ZZ), see permutations -- produce all permutations of a list
• primaryDecomposition -- irredundant primary decomposition of an ideal
• primaryDecomposition(Ideal), see primaryDecomposition -- irredundant primary decomposition of an ideal
• primaryDecomposition(MonomialIdeal), see primaryDecomposition -- irredundant primary decomposition of an ideal
• regex(String,String), see regex
• regex(String,ZZ,String), see regex
• regex(String,ZZ,ZZ,String), see regex
• searchPath(List,String) -- search a path for a file
• searchPath(String), see searchPath(List,String) -- search a path for a file
• select(String,String) -- select substrings matching a regular expression from a string
• select(String,String,String) -- select substrings matching a regular expression from a string
• select(ZZ,Function) -- select integers
• separate(String), see separate -- split a string into substrings
• separate(String,String), see separate -- split a string into substrings
• List - Set, see Set - Set -- set difference
• 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
• subsets(Sequence,ZZ), see subsets -- produce the subsets of a set or list
• subsets(Set), see subsets -- produce the subsets of a set or list
• subsets(Set,ZZ), see subsets -- produce the subsets of a set or list
• subsets(ZZ), see subsets -- produce the subsets of a set or list
• subsets(ZZ,ZZ), see subsets -- produce the subsets of a set or list
• support(ChainComplex) (missing documentation) -- nonzero parts of a chain complex
• toList(BasicList), see toList -- create a list
• toList(Set), see toList -- create a list
• transpose(List) -- transposes a table
• unique -- eliminate duplicates from a list
• unstack(Net), see unstack -- list the rows of a net
• values(HashTable) -- 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
• List / RingMap, see VisibleList / Function -- apply a function to elements of a list
• RingMap \ List, see VisibleList / Function -- apply a function to elements of a list

## Methods that use a list :

• List ? List, see ? -- comparison operator
• ascii(List) -- ASCII character conversion
• 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,ZZ,Ideal), 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,Ring), see basis -- basis or generating set of all or part of a ring, ideal or module
• binomial(List,List) (missing documentation)
• chainComplex(List) -- make a chain complex
• columnPermute(MutableMatrix,ZZ,List), see columnPermute -- permute some columns
• commonRing(List), see commonRing -- find smallest containing ring
• degreesMonoid(List), see degreesMonoid -- get the monoid of degrees
• degreesRing(List) -- the ring of degrees
• depth(List) (missing documentation)
• 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
• dim(List) (missing documentation)
• directSum(List), see directSum -- direct sum of modules or maps
• document(List), see document -- package item: documentation node
• drop(BasicList,List), see drop -- Drop some elements from a list or sequence.
• dual(MonomialIdeal,List) -- the Alexander dual
• eliminate(List,Ideal), see eliminate
• export(List), see export -- package item: export functions
• exportFrom(Package,List) (missing documentation)
• exportMutable(List), see exportMutable -- package item: export writable variables
• exteriorPower(List,Matrix) (missing documentation)
• exteriorPower(List,Module) (missing documentation)
• findFiles(List), see findFiles -- find files recursively
• findHeft(List), see findHeft -- find a heft vector for a list of degrees
• gcd(List), see gcd -- greatest common divisor
• gcdLLL(List), see gcdLLL -- compute the gcd of integers, and small multipliers
• hashTable(List), see hashTable -- make a hash table
• HeaderType List, see HeaderType -- a class of lists with abbreviated constructors
• help(List), see help -- help command
• hilbertFunction(List,CoherentSheaf), see hilbertFunction -- the Hilbert function
• hilbertFunction(List,Ideal), see hilbertFunction -- the Hilbert function
• hilbertFunction(List,Module), see hilbertFunction -- the Hilbert function
• hilbertFunction(List,ProjectiveVariety), 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
• hypertext(List), see hypertext -- prepare hypertext for display
• ideal(List) -- make an ideal
• intersect(List), see intersect -- compute an intersection
• lcm(List), see lcm -- least common multiple
• List ! (missing documentation)
• List ** List (missing documentation)
• List .. List -- rectangular sequences of consecutive lists and sequences
• List ..< List -- rectangular sequences of consecutive lists and sequences
• List ^ List (missing documentation)
• listSymbols(List), see listSymbols -- compact display of symbols and their values
• makePackageIndex(List), see makePackageIndex
• 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
• Matrix ^ List -- select rows
• 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
• mutableMatrix(List), see mutableMatrix -- make a mutable matrix
• MutableMatrix ^ List (missing documentation)
• MutableMatrix _ List (missing documentation)
• new HashTable from List -- make a hash table from a list
• new OptionTable from List (missing documentation)
• norm(List), see norm
• norm(Thing,List) (missing documentation)
• ofClass(List), see ofClass -- English phrases for types
• OptionTable ++ List, see OptionTable ++ OptionTable
• List >> Function, see OptionTable >> Function -- attaching options to a function
• part(List,RingElement) -- sum of terms of a polynomial of a given degree(s)
• partitions(ZZ,List) (missing documentation)
• product(List) -- product of elements
• random(List) -- shuffle a list randomly
• random(List,Ring), see random(Type) -- random element of a type
• Ring / List, see Ring / Ideal -- make a quotient ring
• Ring ^ List -- make a free module
• Ring _ List -- make a monomial from a list of exponents
• 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
• scanLines(Function,List), see scanLines -- apply a function to each line of a file
• selectVariables(List,PolynomialRing) -- make a subring of a polynomial ring generated by selected variables
• Set - List, see Set - Set -- set difference
• SheafOfRings ^ List -- make a graded free coherent sheaf
• sort(List) -- sort a list
• sort(List,Function) (missing documentation)
• standardPairs(MonomialIdeal,List), see standardPairs -- find the standard pairs of a monomial ideal
• submatrixByDegrees(Matrix,List,List) (missing documentation)
• 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
• support(List) (missing documentation)
• switch(List) (missing documentation)
• take(BasicList,List), see take -- Take some elements from a list or sequence.
• tensor(List) (missing documentation)
• TEST(List), see TEST -- package item: register a test of the package
• truncate(List,Ideal), see truncate -- truncate the module at a specified degree
• truncate(List,Module), see truncate -- truncate the module at a specified degree
• undocumented(List), see undocumented -- declare that something need not be documented
• unique(List), see unique -- eliminate duplicates from a list
• vars(List) -- a sequence of variables
• Vector ^ List (missing documentation)
• vector(List) -- make a vector
• VisibleList _ List -- get some entries of a list
• weightRange(List,RingElement), see weightRange -- the pair of lowest and highest weights of the monomials
• width(List) (missing documentation)
• 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.