package links

  1. Overview
  2. Docs

Association-list utilities

val rassoc_eq : ('b -> 'b -> bool) -> 'b -> ('a * 'b) list -> 'a
val rassoc : 'a -> ('b * 'a) list -> 'b
val rassq : 'a -> ('b * 'a) list -> 'b
val rremove_assoc_eq : ('b -> 'b -> bool) -> 'b -> ('a * 'b) list -> ('a * 'b) list
val rremove_assoc : 'a -> ('b * 'a) list -> ('b * 'a) list
val rremove_assq : 'a -> ('b * 'a) list -> ('b * 'a) list
val remove_keys : ('a * 'b) list -> 'a list -> ('a * 'b) list
val alistmap : ('a -> 'b) -> ('c * 'a) list -> ('c * 'b) list

alistmap maps f on the contents-parts of the entries, producing a new alist

val show_fgraph : ?glue:string -> (string -> string) -> string list -> string
val alistmap' : (('a * 'b) -> 'c) -> ('a * 'b) list -> ('a * 'c) list

alistmap' produces an alist by applying f to each element of the alist--f should produce a new contents-part for the entry.

val map2alist : ('a -> 'b) -> 'a list -> ('a * 'b) list

[map2alist f list] makes an alist that maps [x] to [f x] for each item in [list]. This is called the `graph' of f on the domain list.

val graph_func : ('a -> 'b) -> 'a list -> ('a * 'b) list
val range : ('a * 'b) list -> 'b list
val dom : ('a * 'b) list -> 'a list
val lookup_in : ('a * 'b) list -> 'a -> 'b

lookup_in alist is a function that looks up its argument in alist

val lookup : 'a -> ('a * 'b) list -> 'b option

lookup is like assoc but uses option types instead of exceptions to signal absence

OCaml

Innovation. Community. Security.