package fpath

  1. Overview
  2. Docs
On This Page
  1. Path maps
Legend:
Library
Module
Module type
Parameter
Class
Class type

Path maps.

Path maps

include Stdlib.Map.S with type key := t
type !+'a t
val empty : 'a t
val add : t -> 'a -> 'a t -> 'a t
val add_to_list : t -> 'a -> 'a list t -> 'a list t
val update : t -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : t -> 'a -> 'a t
val remove : t -> 'a t -> 'a t
val merge : (t -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val union : (t -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (t * 'a) list
val min_binding_opt : 'a t -> (t * 'a) option
val max_binding_opt : 'a t -> (t * 'a) option
val choose_opt : 'a t -> (t * 'a) option
val find_opt : t -> 'a t -> 'a option
val find_first : (t -> bool) -> 'a t -> t * 'a
val find_first_opt : (t -> bool) -> 'a t -> (t * 'a) option
val find_last : (t -> bool) -> 'a t -> t * 'a
val find_last_opt : (t -> bool) -> 'a t -> (t * 'a) option
val iter : (t -> 'a -> unit) -> 'a t -> unit
val fold : (t -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (t -> 'a -> 'b) -> 'a t -> 'b t
val filter : (t -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (t -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (t -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : t -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : t -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (t -> 'a -> bool) -> 'a t -> bool
val exists : (t -> 'a -> bool) -> 'a t -> bool
val to_list : 'a t -> (t * 'a) list
val to_seq : 'a t -> (t * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (t * 'a) Stdlib.Seq.t
val to_seq_from : t -> 'a t -> (t * 'a) Stdlib.Seq.t
val add_seq : (t * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (t * 'a) Stdlib.Seq.t -> 'a t
val min_binding : 'a t -> (path * 'a) option

Exception safe Map.S.min_binding.

val get_min_binding : 'a t -> path * 'a

get_min_binding is like min_binding but

  • raises Invalid_argument

    on the empty map.

val max_binding : 'a t -> (path * 'a) option

Exception safe Map.S.max_binding.

val get_max_binding : 'a t -> string * 'a

get_min_binding is like max_binding but

  • raises Invalid_argument

    on the empty map.

val choose : 'a t -> (path * 'a) option

Exception safe Map.S.choose.

val get_any_binding : 'a t -> path * 'a

get_any_binding is like choose but

  • raises Invalid_argument

    on the empty map.

val find : path -> 'a t -> 'a option

Exception safe Map.S.find.

val get : path -> 'a t -> 'a

get k m is like Map.S.find but raises Invalid_argument if k is not bound in m.

val dom : 'a t -> set

dom m is the domain of m.

val of_list : (path * 'a) list -> 'a t

of_list bs is List.fold_left (fun m (k, v) -> add k v m) empty bs.

val pp : ?sep:(Stdlib.Format.formatter -> unit -> unit) -> (Stdlib.Format.formatter -> (path * 'a) -> unit) -> Stdlib.Format.formatter -> 'a t -> unit

pp ~sep pp_binding ppf m formats the bindings of m on ppf. Each binding is formatted with pp_binding and bindings are separated by sep (defaults to Format.pp_print_cut). If the map is empty leaves ppf untouched.

val dump : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a t -> unit

dump pp_v ppf m prints an unspecified representation of m on ppf using pp_v to print the map codomain elements.

OCaml

Innovation. Community. Security.