package containers
Install
Dune Dependency
Authors
Maintainers
Sources
md5=f1c717c9a1015e81253f226ae594f547
sha512=7640b6af5a61e53e52eac51f237a06c5c21597374481af218cf0601c2b9059b96254058b92adb73ce20b1dece4ccaffb99d1b29b235c4dc954619738d8d0de40
doc/containers/CCPair/index.html
Module CCPair
Source
Tuple Functions
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.
val map2 :
('a1 -> 'b1 -> 'c1) ->
('a2 -> 'b2 -> 'c2) ->
('a1 * 'a2) ->
('b1 * 'b2) ->
'c1 * 'c2
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.
Swap the components of the tuple.
Map on the left side of the tuple.
Map on the right side of the tuple.
Map on both sides of a tuple.
f &&& g
is fun x -> f x, g x
. It splits the computations into two parts.
Uncurrying (merges the two components of a tuple).
dup x = (x,x)
(duplicate the value).
dup_map f x = (x, f x)
. Duplicates the value and applies the function to the second copy.
Print tuple in a string