aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2014-11-13 20:16:16 +0100
committerHugo Herbelin2014-11-13 21:40:37 +0100
commita71f4ec540ed75310ac1077d93aacf1d60bf308d (patch)
tree57652da2832c84d1895cbc13494a595e402ebfa1
parent014e5ac92a2338f8820be63618c5b0dd631744de (diff)
Move conjugate_verb_to_be next to cString.plural.
-rw-r--r--lib/cString.ml3
-rw-r--r--lib/cString.mli3
-rw-r--r--printing/prettyp.ml7
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/cString.ml b/lib/cString.ml
index 5c857077a6..13ec4e9b70 100644
--- a/lib/cString.ml
+++ b/lib/cString.ml
@@ -22,6 +22,7 @@ sig
val string_index_from : string -> int -> string -> int
val string_contains : where:string -> what:string -> bool
val plural : int -> string -> string
+ val conjugate_verb_to_be : int -> string
val ordinal : int -> string
val split : char -> string -> string list
val is_sub : string -> string -> int -> bool
@@ -131,6 +132,8 @@ let is_sub p s off =
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
string_of_int n ^ s
diff --git a/lib/cString.mli b/lib/cString.mli
index 6aa10875ca..d7afd13160 100644
--- a/lib/cString.mli
+++ b/lib/cString.mli
@@ -47,6 +47,9 @@ sig
val plural : int -> string -> string
(** [plural n s] adds a optional 's' to the [s] when [2 <= n]. *)
+ val conjugate_verb_to_be : int -> string
+ (** [conjugate_verb_to_be] returns "is" when [n=1] and "are" otherwise *)
+
val ordinal : int -> string
(** Generate the ordinal number in English. *)
diff --git a/printing/prettyp.ml b/printing/prettyp.ml
index efdbb0dc42..0d26bbe483 100644
--- a/printing/prettyp.ml
+++ b/printing/prettyp.ml
@@ -79,16 +79,15 @@ let print_ref reduce ref =
(********************************)
(** Printing implicit arguments *)
-let conjugate_verb_to_be = function [_] -> "is" | _ -> "are"
-
let pr_impl_name imp = pr_id (name_of_implicit imp)
let print_impargs_by_name max = function
| [] -> []
| impls ->
- [hov 0 (str (String.plural (List.length impls) "Argument") ++ spc() ++
+ let n = List.length impls in
+ [hov 0 (str (String.plural n "Argument") ++ spc() ++
prlist_with_sep pr_comma pr_impl_name impls ++ spc() ++
- str (conjugate_verb_to_be impls) ++ str" implicit" ++
+ str (String.conjugate_verb_to_be n) ++ str" implicit" ++
(if max then strbrk " and maximally inserted" else mt()))]
let print_one_impargs_list l =