list - operations on lists.
Everything returns a new list, nothing is modified in place except Sort, which sorts a copy.
¶Each = fn(xs, f)source
Each calls f(x) for every element.
¶Map = fn(xs, f)source
Map returns the list of f(x) for every element.
¶Filter = fn(xs, f)source
Filter returns the elements for which f(x) is true.
¶Reduce = fn(xs, acc, f)source
Reduce folds the list from the left starting from acc.
¶Index = fn(xs, x)source
Index returns the position of the first element equal to x, -1 if absent.
¶Contains = fn(xs, x)source
Contains reports whether x is in xs.
¶Find = fn(xs, f)source
Find returns the first element for which f(x) is true, null if there is none.
¶Copy = fn(xs)source
Copy returns a new list with the same elements. slice() would share the same underlying array, so writing into it would touch the original.
¶Reverse = fn(xs)source
Reverse returns the elements in the opposite order.
¶Range = fn(start, stop)source
Range returns the integers from start (included) to stop (excluded).
¶Join = fn(xs, sep)source
Join concatenates the elements as strings separated by sep.
¶Sort = fn(xs, less)source
Sort returns the elements ordered by less(a, b), which must be true when a comes first. Pass null to order with the < operator.