[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: number-sequence
From: |
Kim F. Storm |
Subject: |
Re: number-sequence |
Date: |
21 Nov 2003 13:06:54 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
Luc Teirlinck <address@hidden> writes:
> 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 ??
I think they are all obvious behaviours of number-sequence...
>
> This function was primarily designed for integer arguments.
> Nevertheless, FROM, TO and INC can be integer or float. However,
> floating point arithmetic is inexact. For instance, depending on
> the machine, it may quite well happen that
> \(number-sequence 0.4 0.6 0.2) returns the one element list (0.4),
> whereas \(number-sequence 0.4 0.8 0.2) returns a list with three
> elements. Thus, if some of the arguments are floats and one
> wants to make sure that TO is included, one may have to
> explicitly write TO as \(+ FROM \(* N INC)) or use a variable
> whose value was computed with this exact expression."
You could also suggest to use something like
(number-sequence 0.4 0.61 0.2)
--
Kim F. Storm <address@hidden> http://www.cua.dk