mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-12 14:00:42 -05:00
23 lines
713 B
OCaml
23 lines
713 B
OCaml
(* This file is free software. See file "license" for more details. *)
|
|
|
|
(** {1 Ordered Bag of Elements}
|
|
|
|
A data structure where we can have duplicate elements, optimized for
|
|
fast concatenation and size. *)
|
|
|
|
type +'a t = private E | L of 'a | N of 'a t * 'a t
|
|
|
|
val empty : 'a t
|
|
val is_empty : _ t -> bool
|
|
val return : 'a -> 'a t
|
|
val cons : 'a -> 'a t -> 'a t
|
|
val snoc : 'a t -> 'a -> 'a t
|
|
val append : 'a t -> 'a t -> 'a t
|
|
val of_iter : 'a Iter.t -> 'a t
|
|
val to_iter : 'a t -> 'a Iter.t
|
|
val to_list : 'a t -> 'a list
|
|
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
|
|
val iter : ('a -> unit) -> 'a t -> unit
|
|
|
|
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
|
|
(** Are the two bags equal, element wise? *)
|