add doc for of_list in relevant modules (close #85)

This commit is contained in:
Simon Cruanes 2016-12-29 11:39:21 +01:00
parent eb217a0cf1
commit f0aecf3b8e
4 changed files with 21 additions and 3 deletions

View file

@ -79,7 +79,10 @@ val to_list : ('a,'b) Hashtbl.t -> ('a * 'b) list
(** List of bindings (order unspecified) *)
val of_list : ('a * 'b) list -> ('a,'b) Hashtbl.t
(** From the given list of bindings, added in order *)
(** Build a table from the given list of bindings [k_i -> v_i],
added in order using {!add}. If a key occurs several times,
it will be added several times, and the visible binding
will be the last one. *)
val update : ('a, 'b) Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> unit
(** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if
@ -165,7 +168,10 @@ module type S = sig
(** List of bindings (order unspecified) *)
val of_list : (key * 'a) list -> 'a t
(** From the given list of bindings, added in order *)
(** Build a table from the given list of bindings [k_i -> v_i],
added in order using {!add}. If a key occurs several times,
it will be added several times, and the visible binding
will be the last one. *)
val update : 'a t -> f:(key -> 'a option -> 'a option) -> k:key -> unit
(** [update tbl ~f ~k] updates key [k] by calling [f k (Some v)] if

View file

@ -72,11 +72,16 @@ module type S = sig
val to_list : t -> elt list
val add_list : t -> elt list -> t (** @since 0.16 *)
val add_list : t -> elt list -> t
(** Add the elements of the list to the heap. An element occurring several
times will be added that many times to the heap.
@since 0.16 *)
val of_list : elt list -> t
(** [of_list l = add_list empty l] *)
val add_seq : t -> elt sequence -> t (** @since 0.16 *)
(** Similar to {!add_list} *)
val of_seq : elt sequence -> t

View file

@ -33,6 +33,7 @@ module type S = sig
@since 0.17 *)
val of_seq : (key * 'a) sequence -> 'a t
(** Same as {!of_list} *)
val add_seq : 'a t -> (key * 'a) sequence -> 'a t
(** @since 0.14 *)
@ -40,6 +41,10 @@ module type S = sig
val to_seq : 'a t -> (key * 'a) sequence
val of_list : (key * 'a) list -> 'a t
(** Build a map from the given list of bindings [k_i -> v_i],
added in order using {!add}.
If a key occurs several times, only its last binding
will be present in the result. *)
val add_list : 'a t -> (key * 'a) list -> 'a t
(** @since 0.14 *)

View file

@ -19,6 +19,8 @@ module type S = sig
val to_seq : t -> elt sequence
val of_list : elt list -> t
(** Build a set from the given list of elements,
added in order using {!add}. *)
val add_list : t -> elt list -> t
(** @since 0.14 *)