[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generalize and standarize dired-plural-s

From: Yuri Khan
Subject: Re: Generalize and standarize dired-plural-s
Date: Sun, 18 Sep 2016 23:45:09 +0600

On Sun, Sep 18, 2016 at 9:00 PM, Tino Calancha <address@hidden> wrote:

> I am wondering if it has sense to add a standard function,
> `string-plural-s'

> (defun string-plural-s (arg &optional string plural)
>   "\
> Return plural of STRING if ARG is nil, or an integer >1, or a seq of length
> If ARG is =1 or a sequence of length =1, return STRING.
> Optional arg PLURAL is the plural of STRING.
> If STRING is nil, return \"s\" or \"\"."

The two previous replies in this thread suggest, respectively,
shipping a dictionary of English irregular plurals, and implementing a
mini-language suitable for encoding some but not all English plurals.
(E.g. -f[e] → -ves, -x → -xen are not covered.)

I think the original proposal (requiring both forms to be spelled in
full or falling back to regular plural by passing a nil STRING) is
cheaper to implement and more flexible than a hardcoded dictionary,
and makes for more readable strings in source code than ~P ~:P address@hidden

It is also easier to extend to other languages, if and when we deem it
necessary. (It would require passing an additional argument to specify
language, and more forms (singular, dual, trial, paucal, plural).)

I also suggest that the function be split in two: a core function
dealing with integers only, and a convenience wrapper that also
accepts sequences.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]