CCPair
val make : 'a -> 'b -> ('a, 'b) t
Make a tuple from its components.
map_fst f (x, y)
returns (f x, y)
. Renamed from map1
since 3.0.
map_snd f (x, y)
returns (x, f y)
. Renamed from map2
since 3.0.
Synonym to ( *** )
. Map on both sides of a tuple.
Like map
but specialized for pairs with elements of the same type.
map2 f g (a,b) (x,y)
return (f a x, g b y)
.
map_same2 f (a,b) (x,y)
return (f a x, f b y)
.
Compose the given function with fst
. Rename from map_fst
since 3.0.
Compose the given function with snd
. Rename from map_snd
since 3.0.
f &&& g
is fun x -> f x, g x
. It splits the computations into two parts.
Synonym to merge
.
dup_map f x = (x, f x)
. Duplicates the value and applies the function to the second copy.
Print tuple in a string
type 'a printer = Format.formatter -> 'a -> unit