Lists[A: A]

A primitive containing helper functions for constructing and testing Lists.

primitive val Lists[A: A]

Constructors

create

new val create()
: Lists[A] val^

Returns


Public Functions

empty

Returns an empty list.

fun box empty()
: (Cons[A] val | Nil[A] val)

Returns


cons

Returns a list that has h as a head and t as a tail.

fun box cons(
  h: val->A,
  t: (Cons[A] val | Nil[A] val))
: (Cons[A] val | Nil[A] val)

Parameters

  • h: val->A
  • t: (Cons[A] val | Nil[A] val)

Returns


apply

Builds a new list from an Array

fun box apply(
  arr: Array[val->A] ref)
: (Cons[A] val | Nil[A] val)

Parameters

Returns


from

Builds a new list from an iterator

fun box from(
  iter: Iterator[val->A] ref)
: (Cons[A] val | Nil[A] val)

Parameters

Returns


eq[optional T: Equatable[T] val]

Checks whether two lists are equal.

fun box eq[optional T: Equatable[T] val](
  l1: (Cons[T] val | Nil[T] val),
  l2: (Cons[T] val | Nil[T] val))
: Bool val ?

Parameters

Returns


ne

fun box ne(
  that: Lists[A] val)
: Bool val

Parameters

Returns