gossamer/array

Types

pub type Array(a)

Values

pub fn at(array: Array(a), index index: Int) -> Result(a, Nil)
pub fn concat(array: Array(a), and other: Array(a)) -> Array(a)
pub fn copy_within(
  array: Array(a),
  to target: Int,
  from start: Int,
) -> Array(a)
pub fn copy_within_range(
  array: Array(a),
  to target: Int,
  from start: Int,
  up_to end: Int,
) -> Array(a)
pub fn entries(
  of array: Array(a),
) -> iterator.Iterator(#(Int, a), Nil, Nil)
pub fn every(
  in array: Array(a),
  satisfying predicate: fn(a) -> Bool,
) -> Bool
pub fn fill(array: Array(a), with value: a) -> Array(a)
pub fn fill_range(
  array: Array(a),
  with value: a,
  from start: Int,
  to end: Int,
) -> Array(a)
pub fn filter(
  in array: Array(a),
  keeping predicate: fn(a) -> Bool,
) -> Array(a)
pub fn find(
  in array: Array(a),
  one_that predicate: fn(a) -> Bool,
) -> Result(a, Nil)
pub fn find_index(
  in array: Array(a),
  one_that predicate: fn(a) -> Bool,
) -> Result(Int, Nil)
pub fn find_last(
  in array: Array(a),
  one_that predicate: fn(a) -> Bool,
) -> Result(a, Nil)
pub fn find_last_index(
  in array: Array(a),
  one_that predicate: fn(a) -> Bool,
) -> Result(Int, Nil)
pub fn flat(array: Array(Array(a))) -> Array(a)
pub fn flat_map(
  over array: Array(a),
  with callback: fn(a) -> Array(b),
) -> Array(b)
pub fn for_each(
  in array: Array(a),
  run callback: fn(a) -> b,
) -> Nil
pub fn from_list(list: List(a)) -> Array(a)
pub fn from_list_mapped(
  list: List(a),
  with mapper: fn(a) -> b,
) -> Array(b)
pub fn includes(in array: Array(a), value value: a) -> Bool
pub fn includes_from(
  in array: Array(a),
  value value: a,
  from index: Int,
) -> Bool
pub fn index_every(
  in array: Array(a),
  satisfying predicate: fn(a, Int) -> Bool,
) -> Bool
pub fn index_filter(
  in array: Array(a),
  keeping predicate: fn(a, Int) -> Bool,
) -> Array(a)
pub fn index_find(
  in array: Array(a),
  one_that predicate: fn(a, Int) -> Bool,
) -> Result(a, Nil)
pub fn index_find_index(
  in array: Array(a),
  one_that predicate: fn(a, Int) -> Bool,
) -> Result(Int, Nil)
pub fn index_find_last(
  in array: Array(a),
  one_that predicate: fn(a, Int) -> Bool,
) -> Result(a, Nil)
pub fn index_find_last_index(
  in array: Array(a),
  one_that predicate: fn(a, Int) -> Bool,
) -> Result(Int, Nil)
pub fn index_for_each(
  in array: Array(a),
  run callback: fn(a, Int) -> b,
) -> Nil
pub fn index_map(
  over array: Array(a),
  with callback: fn(a, Int) -> b,
) -> Array(b)
pub fn index_of(
  in array: Array(a),
  value value: a,
) -> Result(Int, Nil)
pub fn index_of_from(
  in array: Array(a),
  value value: a,
  from index: Int,
) -> Result(Int, Nil)
pub fn index_reduce(
  over array: Array(a),
  from initial: b,
  with callback: fn(b, a, Int) -> b,
) -> b
pub fn index_reduce_right(
  over array: Array(a),
  from initial: b,
  with callback: fn(b, a, Int) -> b,
) -> b
pub fn index_some(
  in array: Array(a),
  satisfying predicate: fn(a, Int) -> Bool,
) -> Bool
pub fn join(array: Array(a), with separator: String) -> String
pub fn keys(
  of array: Array(a),
) -> iterator.Iterator(Int, Nil, Nil)
pub fn last_index_of(
  in array: Array(a),
  value value: a,
) -> Result(Int, Nil)
pub fn last_index_of_from(
  in array: Array(a),
  value value: a,
  from index: Int,
) -> Result(Int, Nil)
pub fn length(of array: Array(a)) -> Int
pub fn map(
  over array: Array(a),
  with callback: fn(a) -> b,
) -> Array(b)
pub fn new() -> Array(a)
pub fn pop(from array: Array(a)) -> Result(a, Nil)

Returns the removed element, or an error if the array is empty.

pub fn push(to array: Array(a), value value: a) -> Array(a)
pub fn reduce(
  over array: Array(a),
  from initial: b,
  with callback: fn(b, a) -> b,
) -> b
pub fn reduce_right(
  over array: Array(a),
  from initial: b,
  with callback: fn(b, a) -> b,
) -> b
pub fn reverse(array: Array(a)) -> Array(a)
pub fn shift(from array: Array(a)) -> Result(a, Nil)

Returns the removed element, or an error if the array is empty.

pub fn slice(array: Array(a)) -> Array(a)
pub fn slice_from(array: Array(a), start: Int) -> Array(a)
pub fn slice_range(
  array: Array(a),
  from start: Int,
  to end: Int,
) -> Array(a)
pub fn some(
  in array: Array(a),
  satisfying predicate: fn(a) -> Bool,
) -> Bool
pub fn sort(
  array: Array(a),
  by compare: fn(a, a) -> order.Order,
) -> Array(a)
pub fn splice(
  in array: Array(a),
  from start: Int,
  removing count: Int,
) -> Array(a)

Removes elements and returns them. Mutates the array.

pub fn splice_with(
  in array: Array(a),
  from start: Int,
  removing count: Int,
  inserting items: List(a),
) -> Array(a)

Removes elements, inserts new ones, and returns the removed elements. Mutates the array.

pub fn to_list(array: Array(a)) -> List(a)
pub fn to_reversed(array: Array(a)) -> Array(a)
pub fn to_sorted(
  array: Array(a),
  by compare: fn(a, a) -> order.Order,
) -> Array(a)
pub fn to_spliced(
  array: Array(a),
  from start: Int,
  removing count: Int,
) -> Array(a)
pub fn to_spliced_with(
  array: Array(a),
  from start: Int,
  removing count: Int,
  inserting items: List(a),
) -> Array(a)
pub fn to_string(array: Array(a)) -> String
pub fn unshift(to array: Array(a), value value: a) -> Array(a)
pub fn values(
  of array: Array(a),
) -> iterator.Iterator(a, Nil, Nil)
pub fn with(
  array: Array(a),
  at_index index: Int,
  value value: a,
) -> Array(a)
Search Document