Arrays

Array functions and array member functions.

Array functions and array member functions. 72 entries. This page is generated from the MatchBox source; see the function reference index for how to read the tables and what each gate means.

FunctionFormsGateNotes
arrayAppendarrayAppend( ... ), array.add( ... )alwaysAdds a value to the end of the array in place.
arrayAvgarrayAvg( array ), array.avg()alwaysReturns the average of the elements. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayChunkarrayChunk( array, chunkSize ), array.chunk( chunkSize )alwaysSplits the array into arrays of at most the given size. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayCleararrayClear( ... )alwaysRemoves all elements in place.
arrayContainsarrayContains( array, value ), array.contains( value )alwaysReturns true when the array contains the value (case-sensitive for strings). Defined in the prelude and as a native function; the prelude definition is the one that runs.
arrayContainsNoCasearrayContainsNoCase( array, value ), array.containsNoCase( value )alwaysLike arrayContains, ignoring case. Defined in the prelude and as a native function; the prelude definition is the one that runs.
arrayDeletearrayDelete( array, value, scope = "one" )alwaysRemoves the first matching value in place and returns true.
arrayDeleteAtarrayDeleteAt( ... ), array.deleteAt( ... )alwaysRemoves the element at an index in place and returns it.
arrayDeleteNoCasearrayDeleteNoCase( array, value, scope = "one" ), array.deleteNoCase( value, scope = "one" )alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayEacharrayEach( array, callback, parallel = false, maxThreads = 0, virtual = false )alwaysCalls the callback for each element.
arrayEveryarrayEvery( array, callback )alwaysReturns true when the callback is true for every element.
arrayFilterarrayFilter( array, predicate )alwaysReturns the elements for which the callback returns true.
arrayFindarrayFind( array, value )alwaysReturns the 1-based index of the first match, or 0.
arrayFindAllarrayFindAll( array, value ), array.findAll( value )alwaysReturns the indexes of all matches. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayFindAllNoCasearrayFindAllNoCase( array, value ), array.findAllNoCase( value )alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayFindFirstarrayFindFirst( array, callback, defaultValue ), array.findFirst( callback, defaultValue )alwaysReturns the first element for which the callback returns true. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayFindNoCasearrayFindNoCase( array, value )alwaysLike arrayFind, ignoring case.
arrayFirstarrayFirst( array, defaultValue = null ), array.first( defaultValue = null )alwaysReturns the first element. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayFlatMaparrayFlatMap( array, callback ), array.flatMap( callback )alwaysMaps each element to an array and concatenates the results. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayFlattenarrayFlatten( array, depth = -1 ), array.flatten( depth = -1 )alwaysFlattens nested arrays. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayGetMetadataarrayGetMetadata( array ), array.getMetadata()alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayGroupByarrayGroupBy( array, callback ), array.groupBy( callback )alwaysGroups elements into a struct by the callback result. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayIndexExistsarrayIndexExists( array, index ), array.indexExists( index )alwaysReturns true when the index exists. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayInsertAtarrayInsertAt( ... ), array.insertAt( ... )alwaysInserts a value at an index in place.
arrayIsEmptyarrayIsEmpty( array )alwaysReturns true when the array has no elements. Defined in the prelude and as a native function; the prelude definition is the one that runs.
arrayIsSynchronizedarrayIsSynchronized( ... )always
arrayLastarrayLast( array, defaultValue = null ), array.last( defaultValue = null )alwaysReturns the last element. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayLenarrayLen( ... )alwaysReturns the number of elements in an array.
arrayMaparrayMap( array, callback, parallel = false, maxThreads = 0, virtual = false )alwaysReturns a new array of the callback results. Defined in the prelude and as a native function; the prelude definition is the one that runs.
arrayMaxarrayMax( array ), array.max()alwaysReturns the largest element. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayMedianarrayMedian( array ), array.median()alwaysReturns the median of the elements. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayMergearrayMerge( array1, array2, leaveIndex = false ), array.merge( array2, leaveIndex = false )alwaysReturns an array with the elements of the first array followed by those of the second. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayMinarrayMin( array ), array.min()alwaysReturns the smallest element. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayNewarrayNew( ... )alwaysCreates an empty array.
arrayNonearrayNone( array, callback )alwaysReturns true when the callback is true for no element.
arrayPoparrayPop( ... ), array.pop( ... )alwaysRemoves the last element and returns it.
arrayPrependarrayPrepend( array, value ), array.prepend( value )alwaysAdds a value to the start of the array in place. Defined in the prelude and as a native function; the prelude definition is the one that runs.
arrayPusharrayPush( array, value ), array.push( value )alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayRangearrayRange( start = 1, end, count = null ), array.range( end, count = null )alwaysReturns an array of consecutive integers from start to end. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayReducearrayReduce( array, callback, initialValue )alwaysFolds the array into one value: callback( accumulator, element ), initial value.
arrayReduceRightarrayReduceRight( array, callback, initialValue ), array.reduceRight( callback, initialValue )alwaysLike arrayReduce, from the last element to the first. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayRejectarrayReject( array, predicate ), array.reject( predicate )alwaysReturns the elements for which the callback returns false. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayResizearrayResize( ... ), array.resize( ... )always
arrayReversearrayReverse( array ), array.reverse()alwaysReturns a reversed copy and leaves the original unchanged. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arraySetarraySet( ... ), array.set( ... )always
arrayShiftarrayShift( array, defaultValue ), array.shift( defaultValue )alwaysRemoves the first element and returns it. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arraySlicearraySlice( array, offset, length ), array.slice( offset, length )alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arraySomearraySome( array, callback )alwaysReturns true when the callback is true for at least one element.
arraySortarraySort( array, sortType = "text", sortOrder = "asc" ), array.sort( sortType = "text", sortOrder = "asc" )alwaysSorts the array in place and returns it. Arguments: array, sort type, sort order. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arraySplicearraySplice( array, index, deleteCount = 0, replacements ), array.splice( index, deleteCount = 0, replacements )alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arraySumarraySum( array ), array.sum()alwaysReturns the sum of the elements. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arraySwaparraySwap( ... ), array.swap( ... )alwaysSwaps the elements at two indexes in place.
arrayToListarrayToList( array, delimiter = "," )alwaysJoins the elements with a delimiter, comma by default.
arrayToStructarrayToStruct( array ), array.toStruct()alwaysConverts an array to a struct keyed by 1-based index. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayTransposearrayTranspose( array ), array.transpose()alwaysSwaps the rows and columns of a two-dimensional array. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayUniquearrayUnique( array ), array.unique()alwaysReturns the distinct values, keeping the first occurrence of each. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayUnshiftarrayUnshift( array, value ), array.unshift( value )alwaysMember form needs the prelude function kept; see "Prelude functions called as members" on the index page.
arrayZiparrayZip( array1, array2, callback ), array.zip( array2, callback )alwaysCombines two arrays element by element into pairs. Member form needs the prelude function kept; see "Prelude functions called as members" on the index page.
array.appendarray.append( ... )alwaysAppends a value in place and returns the array, so calls can be chained.
array.cleararray.clear( ... )alwaysRemoves all elements in place.
array.deletearray.delete( ... )alwaysRemoves the element equal to the value (not the element at that index) and returns the array.
array.eacharray.each( ... )always
array.everyarray.every( ... )always
array.filterarray.filter( ... )always
array.findarray.find( ... )alwaysWith a callback, returns the first element for which it returns true (the element itself, not its index).
array.isEmptyarray.isEmpty( ... )alwaysReturns true when the array has no elements.
array.isSynchronizedarray.isSynchronized( ... )always
array.maparray.map( ... )always
array.nonearray.none( ... )always
array.reducearray.reduce( ... )always
array.somearray.some( ... )always
array.toListarray.toList( ... )alwaysJoins the elements into a comma-separated string.
Edit this page Download Markdown Last updated Oct 27, 2026, 1:45:34 PM Report an issue