gleamy/structures/non_empty_list

Types

pub type NonEmptyList(a) {
  End(first: a)
  Next(first: a, rest: NonEmptyList(a))
}

Constructors

  • End(first: a)
  • Next(first: a, rest: NonEmptyList(a))

Functions

pub fn count(list: NonEmptyList(a)) -> Int
pub fn filter(list: NonEmptyList(a), predicate: fn(a) -> Bool) -> List(
  a,
)
pub fn fold(over list: NonEmptyList(a), from initial: b, with fun: fn(
    b,
    a,
  ) -> b) -> b
pub fn from_list(list: List(a)) -> Result(NonEmptyList(a), Nil)
pub fn map(list: NonEmptyList(a), transform: fn(a) -> b) -> NonEmptyList(
  b,
)
pub fn reverse(list: NonEmptyList(a)) -> NonEmptyList(a)
pub fn to_list(list: NonEmptyList(a)) -> List(a)
Search Document