Module CCPair
Tuple Functions
val make : 'a -> 'b -> ('a, 'b) t
Make a tuple from its components.
- since
- 0.16
val map : ('a -> 'c) -> ('b -> 'd) -> ('a * 'b) -> 'c * 'd
Synonym to
( *** )
. Map on both sides of a tuple.
val map_same : ('a -> 'b) -> ('a * 'a) -> 'b * 'b
Like
map
but specialized for pairs with elements of the same type.
val iter : ('a -> 'b -> unit) -> ('a * 'b) -> unit
val swap : ('a * 'b) -> 'b * 'a
Swap the components of the tuple.
val (&&&) : ('a -> 'b) -> ('a -> 'c) -> 'a -> 'b * 'c
f &&& g
isfun x -> f x, g x
. It splits the computations into two parts.
val fold : ('a -> 'b -> 'c) -> ('a * 'b) -> 'c
Synonym to
merge
.- since
- 0.3.3
val dup_map : ('a -> 'b) -> 'a -> 'a * 'b
dup_map f x = (x, f x)
. Duplicates the value and applies the function to the second copy.- since
- 0.3.3