package containers

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v2.8.1.tar.gz
md5=d84e09c5d0abc501aa17cd502e31a038
sha512=8b832f4ada6035e80d81be0cfb7bdffb695ec67d465ed6097a144019e2b8a8f909095e78019c3da2d8181cc3cd730cd48f7519e87d3162442562103b7f36aabb

doc/containers/CCListLabels/Assoc/index.html

Module CCListLabels.AssocSource

Sourcetype ('a, 'b) t = ('a * 'b) list
Sourceval get : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> 'b option

Find the element.

Sourceval get_exn : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> 'b

Like get, but unsafe.

  • raises Not_found

    if the element is not present.

Sourceval set : eq:('a -> 'a -> bool) -> 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t

Add the binding into the list (erase it if already present).

Sourceval mem : eq:('a -> 'a -> bool) -> 'a -> ('a, _) t -> bool

mem x l returns true iff x is a key in l.

  • since 0.16
Sourceval update : eq:('a -> 'a -> bool) -> f:('b option -> 'b option) -> 'a -> ('a, 'b) t -> ('a, 'b) t

update k ~f l updates l on the key k, by calling f (get l k) and removing k if it returns None, mapping k to v' if it returns Some v'.

  • since 0.16
Sourceval remove : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> ('a, 'b) t

remove x l removes the first occurrence of k from l.

  • since 0.17