For an overview of lists and sequences, see lists and sequences.
Normally the entries in a mutable list are not printed, to prevent infinite loops in the printing routines. To print them out, use peek.
|
|
|
|
To construct a mutable list with a given length and whose entries are all null, provide an integer.
|
|
If a value is assigned at a position that is not yet present in a mutable list, then it grows accordingly, and any intermediate positions are filled with null.
|
|
|
Functions that iterate over a mutable list, such as apply, scan, select, any, and for loops, work with a snapshot of its entries taken when the iteration begins. So if the list is modified during the iteration, e.g., by growing or shrinking it, the iteration still visits exactly the original entries, while the modifications take effect in the list itself.
|
|
|
A mutable list may have room for more entries than it currently holds; the number of entries it has room for is its capacity, which is reported by size(BasicList). When an assignment makes the list longer than its capacity, the capacity is doubled until the list fits, so appending entries one at a time takes linear time overall. When the list becomes shorter than a quarter of its capacity, e.g., after using remove, the capacity is halved (but never below 4).
|
|
|
The object MutableList is a type, with ancestor classes BasicList < Thing.
The source of this document is in /build/reproducible-path/macaulay2-1.26.11+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_lists.m2:853:0.