mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-10 05:03:54 -05:00
details
This commit is contained in:
parent
c5b2373c03
commit
29ff651f3b
2 changed files with 9 additions and 0 deletions
|
|
@ -33,9 +33,14 @@ type + 'a t =
|
||||||
|
|
||||||
let nil = `Nil
|
let nil = `Nil
|
||||||
let cons a b = `Cons (a,b)
|
let cons a b = `Cons (a,b)
|
||||||
|
let empty = nil
|
||||||
|
|
||||||
let singleton x = `Cons (x, fun () -> `Nil)
|
let singleton x = `Cons (x, fun () -> `Nil)
|
||||||
|
|
||||||
|
let is_empty = function
|
||||||
|
| `Nil -> true
|
||||||
|
| `Cons _ -> false
|
||||||
|
|
||||||
let to_list l =
|
let to_list l =
|
||||||
let rec direct i (l:'a t) = match l with
|
let rec direct i (l:'a t) = match l with
|
||||||
| `Nil -> []
|
| `Nil -> []
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,14 @@ type + 'a t =
|
||||||
|
|
||||||
val nil : 'a t
|
val nil : 'a t
|
||||||
|
|
||||||
|
val empty : 'a t
|
||||||
|
|
||||||
val cons : 'a -> (unit -> 'a t) -> 'a t
|
val cons : 'a -> (unit -> 'a t) -> 'a t
|
||||||
|
|
||||||
val singleton : 'a -> 'a t
|
val singleton : 'a -> 'a t
|
||||||
|
|
||||||
|
val is_empty : 'a t -> bool
|
||||||
|
|
||||||
val of_list : 'a list -> 'a t
|
val of_list : 'a list -> 'a t
|
||||||
|
|
||||||
val to_list : 'a t -> 'a list
|
val to_list : 'a t -> 'a list
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue