{ "type":"methods", "title":"Array Methods", "object":"A", "intro":[], "methods":{ "a(s/n)":{ "description":"Returns the last index of `x`s/n`` in `A`, or `-1` if not found.", "returns":"N", "version":"1.4.5", "summary":"last index", "alias":"" }, "a(f)":{ "description":"Returns the index of the last element in `A` to return a truthy value when passed through `f`, or `-1` if none do.", "returns":"N", "version":"1.4.5", "summary":"last index", "alias":"" }, "b(s/n)":{ "description":"Returns the first index of `s/n` in `A`, or `-1` if not found.", "returns":"N", "version":"1.4.5", "summary":"first index", "alias":"" }, "b(f)":{ "description":"Returns the index of the first element in `A` to return a truthy value when passed through `f`, or `-1` if none do.", "returns":"N", "version":"1.4.5", "summary":"first index", "alias":"" }, "c()":{ "description":"Returns `A` flattened.", "returns":"A", "version":"1.4.5", "summary":"flatten", "alias":"" }, "c(n)":{ "description":"Returns `A` flattened by `n` levels.", "returns":"A", "version":"1.4.6", "summary":"flatten `n` levels", "alias":"" }, "c(f)":{ "description":"Returns the result of passing each element in `A` through `f` and then flattening by 1 level.", "returns":"A", "version":"1.4.6", "summary":"flat map", "alias":"flatMap" }, "c(a)":{ "description":"Returns the result of concatenating `a` to `A`.", "returns":"A", "version":"1.4.5", "summary":"concat", "alias":"concatenate" }, "d(f?)":{ "description":"Returns `true` if any element of `A` returns a truthy value when passed through `f`, or `false` if none do.", "returns":"B", "version":"1.4.5", "summary":"some", "alias":"some; any; exists" }, "e(f?)":{ "description":"Returns `true` if every element of `A` returns a truthy value when passed through `f`, or `false` if any doesn't.", "returns":"B", "version":"1.4.5", "summary":"all", "alias":"all; every; forall" }, "e(a)":{ "description":"Returns `true` if every element of `A` is exactly equal to the corresponding element of `a`, or `false` if any isn't. Supports multi-dimensional arrays as of [v:1.4.6].", "returns":"B", "version":"1.4.5", "summary":"equal", "alias":"" }, "f(f?)":{ "description":"Returns the elements of `A` that return a truthy value when passed through `f`.", "returns":"A", "version":"1.4.5", "summary":"filter", "alias":"filter; where" }, "f(a,n=0)":{ "description":"Returns the elements of `A` that are also contained in `a` if `n%3=0`; the unique elements that appear in both `A` and `a` if `n%3=1`; or the elements that appear in both `A` and `a` if `n%3=2`.", "returns":"A", "version":"1.4.5", "summary":"TODO", "alias":"TODO" }, "g(n=0)":{ "description":"Returns the element in `A` at index `n`.", "returns":"X", "version":"1.4.5", "summary":"`A[n]`", "alias":"subscript" }, "g(n,...,n)":{ "description":"Returns the element in multi-dimensional `A` at index `n,...,n`.", "returns":"X", "version":"1.4.6", "summary":"`A[n]...[n]`", "alias":"multidimensional subscript; multidimensional index" }, "g(n,...,n?,f)":{ "description":"Returns `A` after first passing the element at index `n,...,n` through `f`. Modifies the original `A`.", "returns":"A", "version":"1.4.6", "summary":"`M!` map `A[n]...[n]` through `f`", "alias":"multidimensional map" }, "g(a)":{ "description":"Returns the elements in `A` at the indices in `a`.", "returns":"A", "version":"1.4.6", "summary":"`A[n]` for n in `a`", "alias":"multiple subscript; multiple index" }, "g(a,f)":{ "description":"Returns `A` after first passing the elements at the indices in `a` through `f`. Modifies the original `A`.", "returns":"A", "version":"1.4.6", "summary":"`M!` map `A[n]` though `f` for `n` in `a`", "alias":"multiple map" }, "g(f)":{ "description":"Returns the result of passing `A` through `f`.", "returns":"A", "version":"1.4.6", "summary":"TODO", "alias":"TODO" }, "h(n=0,x)":{ "description":"Returns `A` with the element at index `n` replaced with `x`. Modifies the original `A`. Arguments may be passed in any order unless `x` is an integer.", "returns":"A", "version":"1.4.5", "summary":"`M!` replace at index", "alias":"replace at index" }, "i(n=0,x)":{ "description":"Returns `A` with `x` inserted at index `n`. Modifies the original `A`. Arguments may be passed in any order unless `x` is an integer.", "returns":"A", "version":"1.4.5", "summary":"`M!` insert at index", "alias":"insert at index" }, "j(n1=0,n2=1)":{ "description":"Returns `n2` elements from `A` starting at index `n1`. Modifies the original `A` by removing those elements.", "returns":"A", "version":"1.4.5", "summary":"`M!` TODO remove subarray", "alias":"remove subarray" }, "k(f?)":{ "description":"Returns the elements of `A` that return a falsey value when passed through `f`.", "returns":"A", "version":"1.4.5", "summary":"filter not", "alias":"filter not; where not" }, "k(a)":{ "description":"Returns `A` with the elements in `a` removed.", "returns":"A", "version":"1.4.5", "summary":"remove multiple", "alias":"remove multiple; delete multiple" }, "k(x)":{ "description":"Returns `A` with `x` removed.", "returns":"A", "version":"1.4.5", "summary":"remove", "alias":"delete" }, "l()":{ "description":"Returns the length of `A`.", "returns":"N", "version":"1.4.5", "summary":"length", "alias":"size" }, "l(f)":{ "description":"Returns elements of `A` whose lengths return a truthy value when passed through `f`.", "returns":"A", "version":"1.4.6", "summary":"filter by length", "alias":"filter by length" }, "l(n)":{ "description":"Returns elements of `A` of length `n`.", "returns":"A", "version":"1.4.6", "summary":"filter by length", "alias":"filter by length" }, "m(f)":{ "description":"Returns the result of passing each element in `A` through `f`.", "returns":"A", "version":"1.4.5", "summary":"map", "alias":"map" }, "n(f?)":{ "description":"Returns `A` sorted by passing each pair of elements `x,y` through `f`. Sorts `x` to the left if `f` returns a value `<0` or `y` to the left if `>0`. Modifies the original `A`.", "returns":"A", "version":"1.4.5", "summary":"`M!` TODO", "alias":"TODO" }, "o(n=1)":{ "description":"Returns the last `n` elements of `A`. If `n=1` then the element itself is returned. Modifies the original `A` by removing those elements.", "returns":"A/X", "version":"1.4.5", "summary":"`M!` remove last", "alias":"remove last multiple; remove multiple last; remove last n; remove n last; pop multiple; multiple pop; pop n" }, "o(f)":{ "description":"Returns the result of passing the last element in `A` through `f`. Modifies the original `A`.", "returns":"A", "version":"1.4.6", "summary":"`M!` map last", "alias":"map last" }, "p(x,...,x)":{ "description":"Returns the result of appending each `x` to `A`. Modifies the original `A`.", "returns":"A", "version":"1.4.5", "summary":"append", "alias":"append" }, "q(x=\"\")":{ "description":"Returns `A` joined with `x`.", "returns":"S", "version":"1.4.5", "summary":"join", "alias":"join; join by; joinBy" }, "r(f,x=A[0])":{ "description":"Returns the result of reducing `A` by `f` with an initial value of `x`.", "returns":"X", "version":"1.4.5", "summary":"reduce", "alias":"reduce; foldl; foldLeft; fold left" }, "s(n1=0,n2=A.length)":{ "description":"Returns the result of slicing `A` from index `n1` to `n2`.", "returns":"A", "version":"1.4.5", "summary":"slice", "alias":"slice" }, "t(n1=0,n2=A.length)":{ "description":"Returns `n2` elements from `A` starting at index `n1`.", "returns":"A", "version":"1.4.5", "summary":"subarray", "alias":"subarray" }, "u(x,...,x)":{ "description":"Returns the result of prepending each `x` to `A`. Modifies the original `A`.", "returns":"A", "version":"1.4.5", "summary":"prepend in reverse", "alias":"reverse prepend in reverse" }, "v()":{ "description":"Returns the first element of `A`. Modifies the original `A` by removing that element.", "returns":"X", "version":"1.4.5", "summary":"`M!` remove first", "alias":"remove first; shift" }, "v(n=1)":{ "description":"Returns the first `n` elements of `A`. Modifies the original `A` by removing those elements.", "returns":"A", "version":"1.4.6", "summary":"", "alias":"remove first multiple; remove multiple first; remove first n; remove n first; shift multiple; multiple shift; shift n" }, "v(f)":{ "description":"Returns the result of passing the first element in `A` through `f`. Modifies the original `A`.", "returns":"A", "version":"1.4.6", "summary":"`M!` map first", "alias":"map first" }, "w()":{ "description":"Returns `A` reversed. Modifies the original `A`.", "returns":"A", "version":"1.4.5", "summary":"`M!` reverse", "alias":"" }, "x(f?)":{ "description":"Returns the result of reducing `A` by addition after first passing each element through `f`.", "returns":"N", "version":"1.4.5", "summary":"map then sum", "alias":"map then sum; map sum" }, "y()":{ "description":"Returns the transposing rows and columns of each element.", "returns":"A", "version":"1.4.5", "summary":"transpose", "alias":"transpose; A'; A^T; AT" }, "y(f)":{ "description":"Returns the result of passing each column in `A` through `f`.", "returns":"A", "version":"1.4.5", "summary":"map columns", "alias":"map columns" }, "z(n=1)":{ "description":"Returns the result of rotating `A` clockwise by `n*90` degrees.", "returns":"A", "version":"1.4.5", "summary":"rotate clockwise 90n\xb0", "alias":"rotate clockwise" }, "à(n?)":{ "description":"Returns all combinations of `A`. If `n` is passed, returns all combinations of length `n`.", "returns":"A", "version":"1.4.5", "summary":"combinations (of length n)", "alias":"combinations of length n" }, "á(n?)":{ "description":"Returns all unique permutations of `A`. If `n` is passed, returns all permutations of length `n`.", "returns":"A", "version":"1.4.5", "summary":"permutations (of length n)", "alias":"permutations of length n" }, "â(x?)":{ "description":"Returns the unique elements of `A` in the order they first appear. If `x` is passed then it is concatenated to A first.", "returns":"A", "version":"1.4.5", "summary":"uniquify (union)", "alias":"uniquify; deduplicate; set union" }, "ã(n?,s/a?)":{ "description":"Returns all subsections of `A`. If `n` is passed, returns all subsections of length `n`. Prior to [v:1.4.6] `n` defaults to `2`. If `s/a` is also passed then it is first prepended to the array.", "returns":"A", "version":"1.4.5" }, "ã(f)":{ "description":"Returns all subssections of `A` after passing each through `f`.", "returns":"A", "version":"1.4.6" }, "ä(f,s/a?)":{ "description":"Returns the result of passing each consecutive pair of elements `x,y` in `A` through `f` with arguments `(x,y,x+y)`. If `s/a` is passed then it is first prepended to the array.", "returns":"A", "version":"1.4.5" }, "å(f,x=A[0])":{ "description":"Returns the result of cumulatively reducing `A` by `f` with an initial value of `x`.", "returns":"A", "version":"1.4.5" }, "æ(f?)":{ "description":"Returns the first element of `A` to return a truthy value when passed through `f`.", "returns":"X", "version":"1.4.5", "summary":"find", "alias":"find first" }, "ç(x)":{ "description":"Returns `A` with each element replaced with `x`.", "returns":"A", "version":"1.4.5", "summary":"replace all", "alias":"replace all" }, "è(f)":{ "description":"Returns the number of elements in `A` that return a truthy value when passed through `f`.", "returns":"N", "version":"1.4.5", "summary":"count matches", "alias":"count matches; number of matches; num matches; nmatches" }, "é(n=1)":{ "description":"Returns the result of rotating `A` right by `n` elements.", "returns":"A", "version":"1.4.5", "summary":"rotate right", "alias":"rotate right; roll right" }, "ê(n=0)":{ "description":"Returns `A` palindromised if `n%2=0`, or the reverse of `A` concatenated to `A`.", "returns":"A", "version":"1.4.5" }, "ê(s)":{ "description":"Returns `true` if `A` is a palindrome, or `false` if it isn't", "returns":"B", "version":"1.4.5", "summary":"is palindrome", "alias":"is palindrome" }, "ë(n1=2,n2=0)":{ "description":"Returns every `n1`th element of `A` starting from index `n2`.", "returns":"A", "version":"1.4.5", "summary":"slice with step", "alias":"slice with step" }, "ì(n/s/a)":{ "description":"Returns the result of converting `A` from an array of base-`n/s/a` digits to base-`10`. (e.g., `[\"b\",\"a\",\"a\",\"b\"].n(\"ab\")` = `[1,0,0,1].ì(2)` = `9`)", "returns":"N", "version":"1.4.5", "summary":"to base 10", "alias":"to base 10; base decimal; decimal base; base convert decimal; base convert to decimal" }, "í(a?,f?)":{ "description":"Returns the result of pairing each element in `A` with the corresponding element in `a`. If `a` is not passed then the indices of the elements in `A` are used instead. If `f` is passed then each pair of elements is reduced by passing it through `f`.", "returns":"A", "version":"1.4.5" }, "î(a/s=[0])":{ "description":"Returns `a/s` repeated and sliced to the length of `A`.", "returns":"A", "version":"1.4.5" }, "ï(a=A,f?)":{ "description":"Returns the result of pairing each element in `A` with each element in `a` and reducing each pair by `f`. If `f` is passed then each pair of elements is reduced by passing it through `f`.", "returns":"A", "version":"1.4.5" }, "ð(f?)":{ "description":"Returns the indices of the elements in `A` that return a truthy value when passed through `f`.", "returns":"A", "version":"1.4.6" }, "ñ(f?)":{ "description":"Returns the elements of `A` sorted as though they had been passed through `f`.", "returns":"A", "version":"1.4.5", "summary":"sort by mapped values", "alias":"sort by mapped values" }, "ò(n=2)":{ "description":"Returns `A` partitioned into arrays of length `n`. If `n` is negative then partitions from the end of `A`", "returns":"A", "version":"1.4.5", "summary":"partition", "alias":"partition; chunk" }, "ò(f)":{ "description":"Returns `A` partitioned between each pair of elements that return a truthy value when passed through `f`.", "returns":"A", "version":"1.4.5", "summary":"TODO partition on match pair", "alias":"partition on match pair" }, "ó(n=2)":{ "description":"Returns `A` partitioned into `n` arrays each containing every `n`th element of `A`.", "returns":"A", "version":"1.4.5" }, "ó(f)":{ "description":"Returns `A` partitioned between each pair of elements that return a falsey value when passed through `f`.", "returns":"A", "version":"1.4.5", "summary":"TODO partition on not match pair", "alias":"partition on not match pair" }, "ô()":{ "description":"Returns `A` partitioned at each falsey element.", "returns":"A", "version":"1.4.5" }, "ô(f)":{ "description":"Returns `A` partitioned at each element that returns a truthy value when passed through `f`.", "returns":"A", "version":"1.4.5" }, "ö(n=1)":{ "description":"Returns `n` random elements from `A` with `n` rounded up to the nearest whole number, if necessary. If `n=1` then the element itself is returned.", "returns":"A/X", "version":"1.4.5" }, "ö(s)":{ "description":"Returns a random permutation of `A`.", "returns":"A", "version":"1.4.5" }, "ö(f)":{ "description":"Returns a random element of `A` that returns a truthy value when passed through `f`.", "returns":"X", "version":"1.4.5" }, "ø(a)":{ "description":"Returns `true` if `A` contains any element of `a`, or `false` if it doesn't.", "returns":"B", "version":"1.4.5" }, "ø(x)":{ "description":"Returns `true` if `A` contains `x`, or `false` if it doesn't.", "returns":"B", "version":"1.4.5" }, "ù(s=\" \",n?)":{ "description":"Returns the result of left-padding each element in `A` with `s` to length `n`. If `n` is not passed then the length of the longest element is used.", "returns":"A", "version":"1.4.5" }, "ú(s=\" \",n?)":{ "description":"Returns the result of right-padding each element in `A` with `s` to length `n`. If `n` is not passed then the length of the longest element is used.", "returns":"A", "version":"1.4.5" }, "û(s=\" \",n?)":{ "description":"Returns the result of centre-padding each element in `A` with `s` to length `n`. If `n` is not passed then the length of the longest element is used.", "returns":"A", "version":"1.4.5" }, "û(f?)":{ "description":"Returns the elements of `A` sorted and grouped by the values returned by passing each through `f`.", "returns":"A", "version":"1.4.6" } } }