Skip to content

@MutSeq[T]

A Seq whose items can be replaced, added, and removed.

Inherits from: AssignSeq[T]

Methods

clear()

Removes all items.

delete index -> Bool

Removes the item at index if it exists, returning whether it did.

Parameters

NameTypeDescription
index Int The position to remove. Negative indexes count from the end.

insert index ...values

Inserts values before index, shifting later items.

Parameters

NameTypeDescription
index Int The position to insert at. Negative indexes count from the end.
...values T The values to insert.

pop[D = Empty] … -> (T | D)

Removes and returns the last item, or the item at index.

Parameters

NameTypeDescription
index? Int The position to remove. Negative indexes count from the end.
:default? D The value to return when the item does not exist.
:else? (() -> D) A block whose result to return when the item does not exist and there is no default.

Errors

IndexError if the item does not exist and there is no default or else.

push ...values

Appends values.

Parameters

NameTypeDescription
...values T The values to append.