package links

  1. Overview
  2. Docs

Association-list utilities

val rassoc_eq : ('b -> 'b0 -> bool) -> 'b1 -> ('a * 'b1) list -> 'a
val rassoc : 'a -> ('b * 'c) list -> 'd
val rassq : 'a -> ('b * 'c) list -> 'd
val rremove_assoc_eq : ('b -> 'b0 -> bool) -> 'b1 -> ('a * 'b1) list -> ('a * 'b1) list
val rremove_assoc : 'a -> ('b * 'c) list -> ('b * 'c) list
val rremove_assq : 'a -> ('b * 'c) list -> ('b * 'c) list
val remove_keys : ('a * 'b) list -> 'c list -> ('a * 'b) list
val alistmap : ('a -> 'b) -> ('c * 'a) list -> ('d * '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) -> ('d * 'e) list -> ('f * 'g) 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) -> 'c list -> ('d * 'e) 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 -> 'c list
val dom : ('a * 'b) list -> 'c list
val lookup_in : ('a * 'b) list -> 'c -> 'd

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

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

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

OCaml

Innovation. Community. Security.