Commit 1ff9f4b0 authored by POTTIER Francois's avatar POTTIER Francois

New function [Misc.count].

parent c430a56d
......@@ -383,6 +383,12 @@ let nth = function
| 3 -> "third"
| i -> Printf.sprintf "%dth" i
let count = function
| 1 -> "one"
| 2 -> "two"
| 3 -> "three"
| i -> Printf.sprintf "%d" i
(* To keep compatibility with OCaml 4.02,
we copy [Array.for_all], which appeared
in 4.03. *)
......
......@@ -185,6 +185,10 @@ module ListExtras : sig
val hash: ('a -> int) -> 'a list -> int
end
(* A nice way of printing [n] in English, for concrete values of [n]. *)
val count: int -> string
(* A nice way of printing "nth" in English, for concrete values of [n]. *)
val nth: int -> string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment