package containers

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type elt

Elements that are to be counted

type t
val create : int -> t

A counter maps elements to natural numbers (the number of times this element occurred)

val incr : t -> elt -> unit

Increment the counter for the given element

val incr_by : t -> int -> elt -> unit

Add or remove several occurrences at once. incr_by c x n will add n occurrences of x if n>0, and remove abs n occurrences if n<0.

val get : t -> elt -> int

Number of occurrences for this element

val decr : t -> elt -> unit

Remove one occurrence of the element

  • since 0.14
val length : t -> int

Number of distinct elements

  • since 0.14
val add_seq : t -> elt sequence -> unit

Increment each element of the sequence

val of_seq : elt sequence -> t

of_seq s is the same as add_seq (create ())

val to_seq : t -> (elt * int) sequence

to_seq tbl returns elements of tbl along with their multiplicity

  • since 0.14
val add_list : t -> (elt * int) list -> unit

Similar to add_seq

  • since 0.14
val of_list : (elt * int) list -> t

Similar to of_seq

  • since 0.14
val to_list : t -> (elt * int) list
  • since 0.14
OCaml

Innovation. Community. Security.