aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/util.mli
diff options
context:
space:
mode:
authorGravatar Matej Kosik <m4tej.kosik@gmail.com>2016-02-17 10:32:40 +0100
committerGravatar Matej Kosik <m4tej.kosik@gmail.com>2016-02-17 11:13:04 +0100
commit06fa0334047a9400d0b5a144601fca35746a53b8 (patch)
treec3afdf28353d5ea096b1c6e3aece87ed17015b1c /lib/util.mli
parent9a7afc12e0573c74d0bb0943372dddc3c61a03f1 (diff)
CLEANUP: Renaming "Util.compose" function to "%"
I propose to change the name of the "Util.compose" function to "%". Reasons: 1. If one wants to express function composition, then the new name enables us to achieve this goal easier. 2. In "Batteries Included" they had made the same choice.
Diffstat (limited to 'lib/util.mli')
-rw-r--r--lib/util.mli10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/util.mli b/lib/util.mli
index 7923c65a3..559874bb8 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -83,7 +83,15 @@ val matrix_transpose : 'a list list -> 'a list list
(** {6 Functions. } *)
val identity : 'a -> 'a
-val compose : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
+
+(** Function composition: the mathematical [∘] operator.
+
+ So [g % f] is a synonym for [fun x -> g (f x)].
+
+ Also because [%] is right-associative, [h % g % f] means [fun x -> h (g (f x))].
+*)
+val (%) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b
+
val const : 'a -> 'b -> 'a
val iterate : ('a -> 'a) -> int -> 'a -> 'a
val repeat : int -> ('a -> unit) -> 'a -> unit