Skip to main content

Array Operations

Length, filtering, mapping, searching, grouping and ordering

FunctionWhat it does
allCheck if all elements match predicate
anyCheck if any element matches predicate
concatThe two arrays joined end to end
countHow many elements the predicate holds for
filterFilter array by predicate
findThe first matching element, or nil
findIndexThe position of the first matching element, or -1
findLastThe last matching element, or nil
firstThe first element, or nil when the array is empty
flattenNested arrays flattened into one
groupByGroups elements into a map keyed by the expression
lastThe last element, or nil when the array is empty
lenArray or string length
mapTransform each element
noneTrue when the predicate holds for no element
oneTrue when the predicate holds for exactly one element
reduceFolds the elements into one value; the running total is #acc and the element is #
sortThe elements in ascending order
sortByThe elements ordered by the expression
takeThe first count elements