mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-08 04:05:30 -05:00
CCFun.id and const
This commit is contained in:
parent
d9ccb619a1
commit
48839be132
2 changed files with 10 additions and 0 deletions
|
|
@ -34,6 +34,10 @@ let flip f x y = f y x
|
||||||
|
|
||||||
let curry f x y = f (x,y)
|
let curry f x y = f (x,y)
|
||||||
|
|
||||||
|
let id x = x
|
||||||
|
|
||||||
|
let const x _ = x
|
||||||
|
|
||||||
let uncurry f (x,y) = f x y
|
let uncurry f (x,y) = f x y
|
||||||
|
|
||||||
let (%>) = compose
|
let (%>) = compose
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,12 @@ val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
|
||||||
val (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
|
val (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
|
||||||
(** Alias to [compose] *)
|
(** Alias to [compose] *)
|
||||||
|
|
||||||
|
val id : 'a -> 'a
|
||||||
|
(** Identity function *)
|
||||||
|
|
||||||
|
val const : 'a -> 'b -> 'a
|
||||||
|
(** [const x y = x] for any [y] *)
|
||||||
|
|
||||||
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
|
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
|
||||||
(** flip arguments *)
|
(** flip arguments *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue