Module CCPair
Tuple Functions
val make : 'a -> 'b -> ('a, 'b) tMake a tuple from its components.
- since
- 0.16
val map_fst : ('a -> 'b) -> ('a * 'c) -> 'b * 'cmap_fst f (x, y)returns(f x, y). Renamed frommap1since 3.0.
val map_snd : ('a -> 'b) -> ('c * 'a) -> 'c * 'bmap_snd f (x, y)returns(x, f y). Renamed frommap2since 3.0.
val map : ('a -> 'c) -> ('b -> 'd) -> ('a * 'b) -> 'c * 'dSynonym to
( *** ). Map on both sides of a tuple.
val map_same : ('a -> 'b) -> ('a * 'a) -> 'b * 'bLike
mapbut specialized for pairs with elements of the same type.
val map2 : ('a1 -> 'b1 -> 'c1) -> ('a2 -> 'b2 -> 'c2) -> ('a1 * 'a2) -> ('b1 * 'b2) -> 'c1 * 'c2map2 f g (a,b) (x,y)return(f a x, g b y).- since
- 3.0
val map_same2 : ('a -> 'b -> 'c) -> ('a * 'a) -> ('b * 'b) -> 'c * 'cmap_same2 f (a,b) (x,y)return(f a x, f b y).- since
- 3.0
val fst_map : ('a -> 'b) -> ('a * _) -> 'bCompose the given function with
fst. Rename frommap_fstsince 3.0.- since
- 0.3.3
val snd_map : ('a -> 'b) -> (_ * 'a) -> 'bCompose the given function with
snd. Rename frommap_sndsince 3.0.- since
- 0.3.3
val iter : ('a -> 'b -> unit) -> ('a * 'b) -> unitval swap : ('a * 'b) -> 'b * 'aSwap the components of the tuple.
val (&&&) : ('a -> 'b) -> ('a -> 'c) -> 'a -> 'b * 'cf &&& gisfun x -> f x, g x. It splits the computations into two parts.
val fold : ('a -> 'b -> 'c) -> ('a * 'b) -> 'cSynonym to
merge.- since
- 0.3.3
val dup_map : ('a -> 'b) -> 'a -> 'a * 'bdup_map f x = (x, f x). Duplicates the value and applies the function to the second copy.- since
- 0.3.3