Subtype of Sequence
Creates a new empty list.
Creates a new list with size elements, each initialized to value.
Returns a list made by repeating the initial one count times.
Returns a list made by adding other to the end of this one.
The number of elements in the list.
Adds value to the end of list.
Adds all elements of seq to the end of the list.
Remove all items from this list.
Creates a new list with only the items from the original that rule returns a truthy value for.
Order of elements will stay the same.
This method uses eager evaluation, so if you want a lazy alternative use lazyFilter.
Returns item index of the list.
Sets item index of this list to value, and returns value.
Returns the index of the first occurrence of value, or None if value is not in the list.
Inserts value into item index of the list, and returns value.
var l = [1, 2, 4, 5] # [1, 2, 4, 5]
l.insert(2, 3) # [1, 2, 3, 4, 5]
Iterates over the values in the list, starting from index 0.
Returns a list created by mapping all elements, in order, with transformation.
This method has eager evaluation; use lazyMap for a lazy version.
Sorts through a partition of a list specified by low and high, and returns the position of the next partition.
Used internally by quicksort.
Runs partition to sort through a partition of a list, and recursively calls itself to eventually sort the whole list.
Used internally by sort() and sort(1).
Removes the first occurrence of value from the list and returns it.
Returns None if value is not found.
Removes the element at index from the list, and returns it.
Sorts this list from least to greatest, using quicksort.
Sorts this list using comparer to compare values. A wrapper around quicksort.
var l = [1, 5, 7, 3, 6] # [1, 5, 7, 3, 6]
l.sort { |a, b| a >= b } # [7, 6, 5, 3, 1]
Returns the sum of all elements in the list. A wrapper around Sequence.reduce.
Switches the values at index index1 and index2.
Joins the elements of this list into a comma-separated string with [ and ] delimiters.