diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2015-02-26 14:31:25 +0100 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2015-02-26 14:38:09 +0100 |
commit | 15a3b57db10e61c9de12b5880b04b46db1494b5b (patch) | |
tree | 7c1f64ab00de98e7b23ac8a88b74a57a614c2470 | |
parent | f712a0523359d5b54b4d4160bc77271fdde094a3 (diff) |
Fixing printing of ordinals.
-rw-r--r-- | lib/cString.ml | 9 | ||||
-rw-r--r-- | lib/pp.ml | 11 | ||||
-rw-r--r-- | tactics/tactics.ml | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/cString.ml b/lib/cString.ml index 250b7cee2..e9006860f 100644 --- a/lib/cString.ml +++ b/lib/cString.ml @@ -135,7 +135,14 @@ let plural n s = if n<>1 then s^"s" else s let conjugate_verb_to_be n = if n<>1 then "are" else "is" let ordinal n = - let s = match n mod 10 with 1 -> "st" | 2 -> "nd" | 3 -> "rd" | _ -> "th" in + let s = + if (n / 10) mod 10 = 1 then "th" + else match n mod 10 with + | 1 -> "st" + | 2 -> "nd" + | 3 -> "rd" + | _ -> "th" + in string_of_int n ^ s (* string parsing *) @@ -517,8 +517,17 @@ let pr_arg pr x = spc () ++ pr x let pr_opt pr = function None -> mt () | Some x -> pr_arg pr x let pr_opt_no_spc pr = function None -> mt () | Some x -> pr x +(** TODO: merge with CString.ordinal *) let pr_nth n = - int n ++ str (match n mod 10 with 1 -> "st" | 2 -> "nd" | 3 -> "rd" | _ -> "th") + let s = + if (n / 10) mod 10 = 1 then "th" + else match n mod 10 with + | 1 -> "st" + | 2 -> "nd" + | 3 -> "rd" + | _ -> "th" + in + int n ++ str s (* [prlist pr [a ; ... ; c]] outputs [pr a ++ ... ++ pr c] *) diff --git a/tactics/tactics.ml b/tactics/tactics.ml index 013270b0b..ccf4795d6 100644 --- a/tactics/tactics.ml +++ b/tactics/tactics.ml @@ -882,7 +882,7 @@ let msg_quantified_hypothesis = function | NamedHyp id -> str "quantified hypothesis named " ++ pr_id id | AnonHyp n -> - int n ++ str (match n with 1 -> "st" | 2 -> "nd" | _ -> "th") ++ + pr_nth n ++ str " non dependent hypothesis" let depth_of_quantified_hypothesis red h gl = |