emacs-devel
[Top][All Lists]
Advanced

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

Re: number-sequence


From: Luc Teirlinck
Subject: Re: number-sequence
Date: Fri, 21 Nov 2003 08:43:02 -0600 (CST)

Kim Storm wrote:

   > TO is only included if there is an N for which TO = FROM + N * INC.  
   > If INC is nil, it defaults to 1 (one) if TO is larger than FROM,
   > or to -1 if TO is less than FROM.
   > If TO is nil or numerically equal to FROM, return (FROM).
   > If INC is positive and TO is less than FROM, or INC is negative
   > and TO is larger than FROM, return nil.
   > If INC is zero and TO is neither nil nor numerically equal to
   > FROM, signal an error.

   Is it really necessary to document all those cases ??

All but the first and the last two sentences specify defaults, and
hence are, I believe necessary.  I believe you suggested the first.
In case of the second to last, there might be some possibility of
expecting (FROM).  Certainly, if you are going to mention that TO is
not necessarily inclusive, it makes sense to point out the one case
where FROM is not inclusive.  The last line tells exactly when an
error is going to occur, which is not obvious in all cases, like
(number-sequence 5 nil 0) or (number-sequence 5 5 0).  They do return
(5), but could equally well have thrown an error.

   You could also suggest to use something like

           (number-sequence 0.4 0.61 0.2)

I believe that, in real programs, the arguments might not be constant
integers.  I will add:

"Alternatively, you can, of course, also replace TO by a slightly
larger value."

to the end of the doc string.

Sincerely,

Luc.
 




reply via email to

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