[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dave.Touretzky@B.GP.CS.CMU.EDU: pluralization: two proposals]
- To: cl-cleanup@sail.stanford.edu
- Subject: [Dave.Touretzky@B.GP.CS.CMU.EDU: pluralization: two proposals]
- From: Guy Steele <gls@Think.COM>
- Date: Mon, 27 Feb 89 13:10:47 EST
To: common-lisp@sail.stanford.edu
Subject: pluralization: two proposals
Date: Mon, 27 Feb 89 04:37:06 EST
From: Dave.Touretzky@B.GP.CS.CMU.EDU
The ~P format directive and its : and @ variants provide only the suffixes
"s" and "ies". What about nouns whose singular forms end in "s" or
"z"? They use "es" to form their plural, e.g.
bus --> buses
glass --> glasses
buzz --> buzzes
First, I propose that ~P and ~:P be modified to produce the "es" plural
form instead of "s" when given a numeric argument of -1.
Second, a more ambitious proposal: how about introducing a new conditional
directive to handle arbitrary singular/plural distinctions:
~:@[ singular ~; plural ~]
If the argument is EQL to 1, the first alternative is taken; otherwise the
second alternative is taken. This lets you do neat things like:
(format nil "There ~:@[is~;are~]~:* ~D~:* ~:@[wolf~;wolves~] here." 3)
==> "There are 3 wolves here."
(format nil "There ~:@[is~;are~]~:* ~D~:* ~:@[wolf~;wolves~] here." 1)
==> "There is 1 wolf here."
(format nil "Your tab comes to ~D~:* ~:@[wolfs'~;wolves'~] head~:P." -5)
==> "Your tab comes to -5 wolves' heads."
(format nil "Your tab comes to ~D~:* ~:@[wolf's~;wolves'~] head~:P." 1)
==> "Your tab comes to 1 wolf's head."
Notes:
1) The example with -5 shows why special plural forms can't simply be
handled with an ordinary conditional by writing
~[plural~;singular~:;plural~]
2) The pluralization conditional is also useful for handling things like
possessive forms (wolf's vs. wolves') and the verb "be" (is vs. are).
-- Dave