aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util.ml4
-rw-r--r--lib/util.mli1
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 6632beaf29..cd575bf08a 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -523,6 +523,10 @@ let pr_coma () = str "," ++ spc ()
let pr_semicolon () = str ";" ++ spc ()
let pr_bar () = str "|" ++ spc ()
+let pr_ord n =
+ let suff = match n mod 10 with 1 -> "st" | 2 -> "nd" | _ -> "th" in
+ int n ++ str suff
+
let rec prlist elem l = match l with
| [] -> mt ()
| h::t -> Stream.lapp (fun () -> elem h) (prlist elem t)
diff --git a/lib/util.mli b/lib/util.mli
index aa7042903d..6bbe609cbd 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -172,6 +172,7 @@ val pr_str : string -> std_ppcmds
val pr_coma : unit -> std_ppcmds
val pr_semicolon : unit -> std_ppcmds
val pr_bar : unit -> std_ppcmds
+val pr_ord : int -> std_ppcmds
val prlist : ('a -> std_ppcmds) -> 'a list -> std_ppcmds
val prvecti : (int -> 'a -> std_ppcmds) -> 'a array -> std_ppcmds