🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2800

Re: Printing plural forms.

#2800
From: Nick Rothwell
Date: Tue, 19 Feb 1991 16:03
25 lines
1746 bytes
I just lifted some SML code from my Make system which does this kind
of thing. PrintCount takes a word split into stem, singular and plural.
It handles nasty words like "dependencies" (what does Common Lisp come
up with: "dependencys"?)

            fun PrintCount(1, (word, single, _)) =
                   Busy.print("1 " ^ word ^ single)   |
                PrintCount(n, (word, _, plural)) =
                   Busy.print(makestring n ^ " " ^ word ^ plural)
...
            fun PrintCounts() =
               (Busy.print "Tag information: ";
                PrintCount(!DepCount, ("dependenc", "y", "ies"));
                Busy.print " found involving ";
                PrintCount(!TagCount, ("tag", "", "s"));
                Busy.print " in ";
                PrintCount(!FileCount, ("file", "", "s"));
                Busy.println ""
               )

-- 
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~  Captain Waldorf has analogue filters. You do not.  ~~ ~~ ~~ ~~
~~ ~~ ~~ ~~ Do not try to imitate them or any of their actions. ~~ ~~ ~~ ~~
Technical Details
Message-ID: <6464@skye.cs.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!wuarchive!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick
References: <1991Feb19.104810.549@ZYX.SE> <2706@kraftbus.cs.tu-berlin.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!wuarchive!uunet!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick
From: nick@cs.edinburgh.ac.uk (Nick Rothwell)
Newsgroups: comp.lang.misc
Subject: Re: Printing plural forms.
Message-ID: <6464@skye.cs.ed.ac.uk>
Date: 19 Feb 91 16:03:23 GMT
References: <1991Feb19.104810.549@ZYX.SE> <2706@kraftbus.cs.tu-berlin.de>
Sender: nnews@cs.ed.ac.uk
Reply-To: nick@lfcs.ed.ac.uk
Organization: Tasha Yar Appreciation Soc... oh, sh*t
Lines: 25