Map.Using_comparator
Using_comparator
is a similar interface as the toplevel of Map
, except the functions take a ~comparator:('k, 'cmp) Comparator.t
, whereas the functions at the toplevel of Map
take a ('k, 'cmp) comparator
.
type nonrec ('k, +'v, 'cmp) t = ('k, 'v, 'cmp) t
val t_of_sexp_direct : comparator:('k, 'cmp) Comparator.t ->
(Sexp.t -> 'k) -> (Sexp.t -> 'v) -> Sexp.t -> ('k, 'v, 'cmp) t
module Tree : sig ... end
val invariants : (_, _, _) t -> bool
val is_empty : (_, _, _) t -> bool
val length : (_, _, _) t -> int
val find_multi : ('a, 'b list, 'cmp) t -> 'a -> 'b list
val find : ('a, 'b, 'cmp) t -> 'a -> 'b option
val find_exn : ('a, 'b, 'cmp) t -> 'a -> 'b
val mem : ('a, 'b, 'cmp) t -> 'a -> bool
val iter_keys : ('a, _, 'cmp) t -> f:('a -> unit) -> unit
val iter : (_, 'b, 'cmp) t -> f:('b -> unit) -> unit
val iteri : ('a, 'b, 'cmp) t -> f:(key:'a -> data:'b -> unit) -> unit
val iteri_until : ('a, 'b, 'cmp) t -> f:(key:'a -> data:'b -> Base__Map_intf.Continue_or_stop.t) -> Base__Map_intf.Finished_or_unfinished.t
val fold : ('a, 'b, _) t -> init:'c -> f:(key:'a -> data:'b -> 'c -> 'c) -> 'c
val fold_right : ('a, 'b, _) t -> init:'c -> f:(key:'a -> data:'b -> 'c -> 'c) -> 'c
val combine_errors : ('a, 'b Or_error.t, 'cmp) t -> ('a, 'b, 'cmp) t Or_error.t
val keys : ('a, _, _) t -> 'a list
val data : (_, 'b, _) t -> 'b list
val to_alist : ?key_order:[ `Increasing | `Decreasing ] ->
('a, 'b, _) t -> ('a * 'b) list
val validate : name:('a -> string) -> 'b Validate.check -> ('a, 'b, _) t Validate.check
val validatei : name:('a -> string) -> ('a * 'b) Validate.check -> ('a, 'b, _) t Validate.check
val symmetric_diff : ('a, 'b, 'cmp) t -> ('a, 'b, 'cmp) t -> data_equal:('b -> 'b -> bool)
-> ('a * [ `Left of 'b | `Right of 'b | `Unequal of 'b * 'b ]) Sequence.t
val min_elt : ('a, 'b, 'cmp) t -> ('a * 'b) option
val min_elt_exn : ('a, 'b, 'cmp) t -> 'a * 'b
val max_elt : ('a, 'b, 'cmp) t -> ('a * 'b) option
val max_elt_exn : ('a, 'b, 'cmp) t -> 'a * 'b
val for_all : (_, 'b, _) t -> f:('b -> bool) -> bool
val for_alli : ('a, 'b, _) t -> f:(key:'a -> data:'b -> bool) -> bool
val exists : (_, 'b, _) t -> f:('b -> bool) -> bool
val existsi : ('a, 'b, _) t -> f:(key:'a -> data:'b -> bool) -> bool
val count : (_, 'b, _) t -> f:('b -> bool) -> int
val counti : ('a, 'b, _) t -> f:(key:'a -> data:'b -> bool) -> int
val subrange : ('k, 'v, 'cmp) t -> lower_bound:'k Maybe_bound.t -> upper_bound:'k Maybe_bound.t ->
('k, 'v, 'cmp) t
val fold_range_inclusive : ('a, 'b, _) t -> min:'a -> max:'a -> init:'c -> f:(key:'a
-> data:'b -> 'c -> 'c) -> 'c
val range_to_alist : ('a, 'b, _) t -> min:'a -> max:'a -> ('a * 'b) list
val closest_key : ('a, 'b, _) t -> [ `Greater_or_equal_to | `Greater_than | `Less_or_equal_to | `Less_than ] -> 'a -> ('a * 'b) option
val nth : ('a, 'b, _) t -> int -> ('a * 'b) option
val nth_exn : ('a, 'b, _) t -> int -> 'a * 'b
val rank : ('a, _, _) t -> 'a -> int option
val to_sequence : ?order:[ `Increasing_key | `Decreasing_key ] ->
?keys_greater_or_equal_to:'a -> ?keys_less_or_equal_to:'a ->
('a, 'b, _) t -> ('a * 'b) Sequence.t
val binary_search : ('k, 'v, _) t -> compare:(key:'k -> data:'v -> 'key -> int) ->
[ `Last_strictly_less_than | `Last_less_than_or_equal_to | `Last_equal_to | `First_equal_to | `First_greater_than_or_equal_to | `First_strictly_greater_than ] -> 'key -> ('k * 'v) option
val binary_search_segmented : ('k, 'v, _) t -> segment_of:(key:'k -> data:'v ->
[ `Left | `Right ]) -> [ `Last_on_left | `First_on_right ] -> ('k * 'v) option
val empty : comparator:('a, 'cmp) Comparator.t -> ('a, _, 'cmp) t
val singleton : comparator:('a, 'cmp) Comparator.t -> 'a -> 'b -> ('a, 'b, 'cmp) t
val of_alist : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) list -> [ `Ok of ('a, 'b, 'cmp) t | `Duplicate_key of 'a ]
val of_alist_or_error : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) list -> ('a, 'b, 'cmp) t Or_error.t
val of_alist_exn : comparator:('a, 'cmp) Comparator.t -> ('a * 'b) list -> ('a, 'b, 'cmp) t
val of_alist_multi : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) list -> ('a, 'b list, 'cmp) t
val of_alist_fold : comparator:('a, 'cmp) Comparator.t -> ('a * 'b) list -> init:'c ->
f:('c -> 'b -> 'c) -> ('a, 'c, 'cmp) t
val of_alist_reduce : comparator:('a, 'cmp) Comparator.t -> ('a * 'b) list -> f:('b -> 'b -> 'b)
-> ('a, 'b, 'cmp) t
val of_sorted_array : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) array -> ('a, 'b, 'cmp) t Or_error.t
val of_sorted_array_unchecked : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) array -> ('a, 'b, 'cmp) t
val of_increasing_iterator_unchecked : comparator:('a, 'cmp) Comparator.t -> len:int ->
f:(int -> 'a * 'b) -> ('a, 'b, 'cmp) t
val of_increasing_sequence : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) Sequence.t -> ('a, 'b, 'cmp) t Or_error.t
val of_sequence : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) Sequence.t -> [ `Ok of ('a, 'b, 'cmp) t | `Duplicate_key of 'a ]
val of_sequence_or_error : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) Sequence.t -> ('a, 'b, 'cmp) t Or_error.t
val of_sequence_exn : comparator:('a, 'cmp) Comparator.t -> ('a * 'b) Sequence.t -> ('a, 'b, 'cmp) t
val of_sequence_multi : comparator:('a, 'cmp) Comparator.t ->
('a * 'b) Sequence.t -> ('a, 'b list, 'cmp) t
val of_sequence_fold : comparator:('a, 'cmp) Comparator.t -> ('a * 'b) Sequence.t -> init:'c ->
f:('c -> 'b -> 'c) -> ('a, 'c, 'cmp) t
val of_sequence_reduce : comparator:('a, 'cmp) Comparator.t -> ('a * 'b) Sequence.t -> f:('b -> 'b -> 'b) ->
('a, 'b, 'cmp) t
val of_iteri : comparator:('a, 'cmp) Comparator.t -> iteri:(f:(key:'a -> data:'b -> unit) ->
unit) -> [ `Ok of ('a, 'b, 'cmp) t | `Duplicate_key of 'a ]
val of_tree : comparator:('a, 'cmp) Comparator.t -> ('a, 'b, 'cmp) Tree.t -> ('a, 'b, 'cmp) t
val comparator : ('a, _, 'cmp) t -> ('a, 'cmp) Comparator.t
val hash_fold_direct : 'k Hash.folder -> 'v Hash.folder -> ('k, 'v, 'cmp) t Hash.folder
module Empty_without_value_restriction (K : Comparator.S1) : sig ... end
To get around the value restriction, apply the functor and include it. You can see an example of this in the Poly
submodule below.