package octez-libs

  1. Overview
  2. Docs

A non-empty list

type 'a t = {
  1. head : 'a;
  2. tail : 'a list;
}
exception Empty_list
val of_pair : ('a * 'a) -> 'a t

Make a non-empty list from a pair.

val of_list_exn : 'a list -> 'a t

Make a non-empty list from a list, raising an exception on empty list.

val length : 'a t -> int

Return the length of the given list.

val nth_exn : 'a t -> int -> 'a

Index the given list, raising an exception on bounds error. For testing only.

OCaml

Innovation. Community. Security.