Since I'm also doing a lot of text oriented processing[...]
I'm usually using some pluralization, e.g. in "C" like
printf ("Copy %d item%s ...", n, (n>1 ? "s" : "") );
Often we stumble across text output from software, like
Copy 42 items (12 minutes left).
...
Copy 1 items (1 minutes left).
Since I'm also doing a lot of text oriented processing
I'm usually using some pluralization, e.g. in "C" like
printf ("Copy %d item%s ...", n, (n>1 ? "s" : "") );
[...]. So instead of inline-ternary operators ?:
or procedures these Algol 68 operator variants emerged:
PRIO PLURAL = 6;
OP PLURAL = (INT amount, STRING word) STRING :
whole (amount, 0) + word + ( amount > 1 | "s" | "" );
alleviating the application text from "stringifying"
with an explicit whole(n,0) or conditionals. Producing
output (depending on the variant) like
Get 1 horse or 2 dogs or 3 cats or 12 fleas to get happy.
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
Since I'm also doing a lot of text oriented processing[...]
I'm usually using some pluralization, e.g. in "C" like
printf ("Copy %d item%s ...", n, (n>1 ? "s" : "") );
I'd probably write :
printf("Copy %d item%s ...", n, n==1 ? "" : "s");
"Copy 0 items" seems more correct than "Copy 0 item".
On 23/08/2025 17:49, Janis Papanagnou wrote:
Often we stumble across text output from software, like
Copy 42 items (12 minutes left).
...
Copy 1 items (1 minutes left).
Since I'm also doing a lot of text oriented processing
I'm usually using some pluralization, e.g. in "C" like
printf ("Copy %d item%s ...", n, (n>1 ? "s" : "") );
Firstly, I agree with Keith that English uses the
plural in the case n = 0; n < 0 is, I suppose, unlikely to
occur in real examples.
[...]. So instead of inline-ternary operators ?:
or procedures these Algol 68 operator variants emerged:
PRIO PLURAL = 6;
OP PLURAL = (INT amount, STRING word) STRING :
whole (amount, 0) + word + ( amount > 1 | "s" | "" );
Secondly, if you're generalising, then you "should" look
at the end of "word": eg "flies" rather than "flys". I accept,
of course, that there are limits to how much should be done; you
can spend years tweaking stuff like that.
[...]
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,066 |
Nodes: | 10 (0 / 10) |
Uptime: | 172:29:20 |
Calls: | 13,708 |
Calls today: | 2 |
Files: | 186,949 |
D/L today: |
7,817 files (2,163M bytes) |
Messages: | 2,415,892 |