package containers

  1. Overview
  2. Docs
A modular, clean and powerful extension of the OCaml standard library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

containers-3.17.tbz
sha256=0f70824867269c02bf01ae12206aa47a6f669d69f1954c19e68ece9f444f1cba
sha512=11de2d7b7173659e6b83c487ac116a93d4b780b86da07386e7604f8fd45f6841e93cba59dba59ed7dbf6e1bc26561202ae1d2e7238a12f588dfd557d4f2da589

doc/containers/CCRef/index.html

Module CCRefSource

Helpers for references

  • since 0.9
Sourcetype 'a printer = Format.formatter -> 'a -> unit
Sourcetype 'a ord = 'a -> 'a -> int
Sourcetype 'a eq = 'a -> 'a -> bool
Sourcetype 'a iter = ('a -> unit) -> unit
Sourcetype 'a t = 'a ref
Sourceval map : ('a -> 'b) -> 'a t -> 'b t

Transform the value.

Sourceval create : 'a -> 'a t

Alias to ref.

Sourceval iter : ('a -> unit) -> 'a t -> unit

Call the function on the content of the reference.

Sourceval update : ('a -> 'a) -> 'a t -> unit

Update the reference's content with the given function.

Sourceval incr_then_get : int t -> int

incr_then_get r increments r and returns its new value, think ++r.

  • since 0.17
Sourceval get_then_incr : int t -> int

get_then_incr r increments r and returns its old value, think r++.

  • since 0.17
Sourceval swap : 'a t -> 'a t -> unit

swap t1 t2 puts !t2 in t1 and !t1 in t2.

  • since 1.4
Sourceval protect : 'a t -> 'a -> (unit -> 'b) -> 'b

protect r x f sets r := x; calls f(); restores r to its old value; and returns the result of f().

  • since 3.10
Sourceval compare : 'a ord -> 'a t ord
Sourceval equal : 'a eq -> 'a t eq
Sourceval to_list : 'a t -> 'a list
Sourceval to_iter : 'a t -> 'a iter
  • since 3.0
Sourceval pp : 'a printer -> 'a t printer