For an overview of lists and sequences, see lists and sequences.
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.
In Macaulay2, there are several kinds of lists, the main difference being their notation. These include
Array and
Sequence. See
VisibleList.