652 B
652 B
Lists
Lists are a standard Ava type. Specifically, List[A]
represents a linked list.
let x: List[Int32] := { 1, 2, 3 }
let y := prepend(x, 0)
let z := append(x, { 4, 5 })
let w: Option[Int32] := head(x)
let tail: List[Int32] := tail(x)
let sz: List[Int32] := size(x)
Type Class Support
Monad
Monoid
Show
Eq
NonEmptyList
The type NonEmptyList
is a list which cannot be empty:
given A
record NonEmptyList: (head: A, tail: List[A])
Indexing
Lists cannot be accessed by index.
Implementation
given A
enum List
object Nil
given A
record List(head: A, tail: List[A])
end enum