
core
Array
=
defn
(λ [(Ref (Array a)), (Ref (Array a))] Bool)
Compare two arrays.
aset
template
(λ [(Array t), Int, t] (Array t))
aset!
template
(λ [(Ref (Array t)), Int, t] ())
aupdate
defn
(λ [(Array a), Int, (λ [&a] a)] (Array a))
Swap indices i and j of array a in place.
aupdate!
defn
(λ [(Ref (Array a)), Int, (λ [&a] a)] ())
concat
defn
(λ [(Ref (Array (Array a)))] (Array a))
Returns a new Array which is the concatenation of the provided `xs`.
copy
template
(λ [(Ref (Array a))] (Array a))
copy-map
defn
(λ [(λ [&a] b), (Ref (Array a))] (Array b))
Map over array a using function f (copies the array).
delete
template
(λ [(Array a)] ())
element-count
defn
(λ [(Ref (Array a)), &a] Int)
Count occurrences of element e in an array.
endo-map
template
(λ [(λ [a] a), (Array a)] (Array a))
enumerated
defn
(λ [(Ref (Array a))] (Array (Pair Int a)))
Create a new array of Pair:s where the first position is the index and the second position is the element from the original array.
filter
template
(λ [(λ [&a] Bool), (Array a)] (Array a))
first
defn
(λ [(Ref (Array a))] a)
Take the first element of an array.
index-of
defn
(λ [(Ref (Array a)), a] Int)
Get the index of element e in an array.
last
defn
(λ [(Ref (Array a))] a)
Take the last element of an array.
length
template
(λ [(Ref (Array t))] Int)
maximum
defn
(λ [(Ref (Array a))] a)
Get the maximum in an array (elements must support <).
minimum
defn
(λ [(Ref (Array a))] a)
Sum an array (elements must support + and zero).
nth
template
(λ [(Ref (Array t)), Int] &t)
pop-back
template
(λ [(Array a)] (Array a))
prefix-array
defn
(λ [(Ref (Array a)), Int] (Array a))
Get prefix-array to end-index.
prn
defn
(λ [(Ref (Array a))] String)
push-back
template
(λ [(Array a), a] (Array a))
range
defn
(λ [Int, Int, Int] (Array Int))
Create an array from start to end with step between them (the elements must support <, <=, and >=).
raw
template
(λ [(Array t)] (Ptr t))
reduce
defn
(λ [(λ [&a, &b] a), a, (Ref (Array b))] a)
Reduce an array, using the function f.
repeat
defn
(λ [Int, (λ [] a)] (Array a))
Repeat function f n times and store the results in an array.
repeat-indexed
defn
(λ [Int, (λ [Int] a)] (Array a))
Repeat function f n times and store the results in an array (will be supplied with the index).
replicate
defn
(λ [Int, &a] (Array a))
Repeat element e n times and store the results in an array.
reverse
defn
(λ [(Array a)] (Array a))
Reverse an array.
sort
defn
(λ [(Array a)] (Array a))
Sort an array (the elements must support cmp).
sort-with
template
(λ [(Array t), (λ [&t, &t] Int)] (Array t))
str
template
(λ [(Ref (Array a))] String)
subarray
defn
(λ [(Ref (Array a)), Int, Int] (Array a))
Get subarray from start-index to end-index.
suffix-array
defn
(λ [(Ref (Array a)), Int] (Array a))
Get subarray from start-index.
sum
defn
(λ [(Ref (Array a))] a)
sum-length
defn
(λ [(Ref (Array (Array a)))] Int)
Returns the sum of lengths from an Array of Arrays.
swap
defn
(λ [(Array a), Int, Int] (Array a))
swap!
defn
(λ [(Ref (Array a)), Int, Int] ())
zip
defn
(λ [(λ [&a, &b] c), (Ref (Array a)), (Ref (Array b))] (Array c))
Map over two arrays using a function that takes two arguments. Produces a new array with the length of the shorter input.