Hash_set.Poly
A hash set that uses polymorphic comparison.
type nonrec 'a t = 'a t
include Ppx_sexp_conv_lib.Sexpable.S1 with type 'a t := 'a t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
val create : ?growth_allowed:bool -> ?size:int -> unit -> 'a t
include Base.Container.Generic with type 'a t := 'a t with type 'a elt := 'a elt
val length : _ t -> int
val is_empty : _ t -> bool
val fold_result : 'a t -> init:'accum -> f:('accum -> 'a elt -> ('accum, 'e) Base.Result.t) ->
('accum, 'e) Base.Result.t
val mem : 'a t -> 'a -> bool
override Container.Generic.mem
val add : 'a t -> 'a -> unit
val strict_add : 'a t -> 'a -> unit Base.Or_error.t
strict_add t x
returns Ok ()
if the x
was not in t
, or an Error
if it was.
val strict_add_exn : 'a t -> 'a -> unit
val remove : 'a t -> 'a -> unit
val strict_remove : 'a t -> 'a -> unit Base.Or_error.t
strict_remove t x
returns Ok ()
if the x
was in t
, or an Error
if it was not.
val strict_remove_exn : 'a t -> 'a -> unit
val clear : 'a t -> unit
val filter_inplace : 'a t -> f:('a -> bool) -> unit
inter t1 t2
computes the set intersection of t1
and t2
. Runs in O(min(length t1, length t2)). Behavior is undefined if t1
and t2
don't have the same equality function.
val of_hashtbl_keys : ('a, _) Base.Hashtbl.t -> 'a t
val to_hashtbl : 'key t -> f:('key -> 'data) -> ('key, 'data) Base.Hashtbl.t