Pair(3)
β¨ NAME β¨
okay so bestie, welcome to the Pair(3) page from the OCaml library π
β the module is called Pair, and it is Operations on pairs. no cap.
π§ Module π§
Module Pair
Module Pair
: sig end
π Documentation π
Module Pair : sig end
Operations on pairs.
Since 5.4 π
π Pairs π
type ('a, 'b) t = 'a * 'bβ this is the type for pairs. iconic.val make : 'a -> 'b -> 'a * 'bβmake a bis the pair(a, b).val fst : 'a * 'b -> 'aβfst (a, b)isa.val snd : 'a * 'b -> 'bβsnd (a, b)isb.val swap : 'a * 'b -> 'b * 'aβswap (a, b)is(b, a).
π¦ Iterators π¦
val fold : ('a -> 'b -> 'c) -> 'a * 'b -> 'cβfold f (a, b)appliesftoaandb.val map : ('a -> 'c) -> ('b -> 'd) -> 'a * 'b -> 'c * 'dβmap f g (a, b)appliesftoaandgtob.val iter : ('a -> unit) -> ('b -> unit) -> 'a * 'b -> unitβiter f g (a, b)first appliesftoa, and thengtob.val map_fst : ('a -> 'c) -> 'a * 'b -> 'c * 'bβmap_fst f pappliesftop's first component.val map_snd : ('b -> 'c) -> 'a * 'b -> 'a * 'cβmap_snd f pappliesftop's second component.
π Predicates and comparisons π
val equal : ('a -> 'a -> bool) -> ('b -> 'b -> bool) -> 'a * 'b -> 'a * 'b -> boolβequal eqa eqb (a1, b1) (a2, b2)istrueif and only ifeqa a1 a2andeqb b1 b2are bothtrue.val compare : ('a -> 'a -> int) -> ('b -> 'b -> int) -> 'a * 'b -> 'a * 'b -> intβcompare cmpa cmpbis a total order on pairs usingcmpato compare the first component, andcmpbto compare the second component. It is implemented by a lexicographic order.
and that's the whole page, bestie π«Ά β brought to you by OCamldoc, dated 2026-06-22, for Pair(3) π
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms