The List Class
This page details the properties of the List class. To learn about what the List class is and how you would use it, read about them in this tutorial.
Please note that this reference is elliptical because we autogenerated it. Consider it not a lesson but a reference.
* nan list of n instances of the receiver concatenated together
[i]returns the ith element of the receiver, where 0 is the first element of the list; negative indices count from the end.
.lengthone greater than the index of the element with the highest index (not necessarily the same as count)
.countthe number of elements the programmer explicitly set (not necessarily the same as length)
.empty?(as in Scheme, Ruby)
.delete-at![i]deletes the ith element of the receiver
.insert![i, x, n=1]inserts x n times at i
.push!returns the receiver (as in Ruby)
.index-of[x]returns the index of the first occurance of x in the receiver.
.last-index-of[x]Like .index-of, but from the end of the list; returns the index of the last occurance of x in the receiver.
copies the list before iterating; if given an index or range, maps over only those elements
.pluck![key](as in Underscore.js)
.invoke![key](as in Underscore.js)
.filter![f]returns a list containing only the elements for which f[e] is true
.reject![f]The opposite of .filter; returns a list containing only the elements for which f[e] is false
.every[f].every returns true if for every element x in the receiver, f[x] is true
.every copies the list before iterating
.any[f].any returns true if for any element x in the receiver, f[x] is true.
compare to .every[f]
.any copies the list before iterating