[Top][All Lists]

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

Re: request for a new function, say, `sequence'

From: Miles Bader
Subject: Re: request for a new function, say, `sequence'
Date: 03 Apr 2003 12:44:46 +0900

Kenichi Handa <address@hidden> writes:
> I've just installed it in subr.el.  I implemented it as below.

The interface looks good.

How about the following implementation:

   (defun number-sequence (from &optional to)
     "Return a sequence of numbers from FROM to TO (both inclusive) as a list.
   The Nth element of the list is (+ FROM N) where N counts from zero.
   If TO is nil, it defaults to FROM.
   If TO is less than FROM, the value is nil."
     (unless to
       (setq to from))
     (let ((seq nil))
       (while (>= to from)
         (push to seq)
         (setq to (1- to)))

> In Emacs, the word "number" includes a floating number.  Should we
> make number-sequence work also for floating numbers?

Well, it will already, as long as TO and FROM differ by an integral amount...

"Though they may have different meanings, the cries of 'Yeeeee-haw!' and
 'Allahu akbar!' are, in spirit, not actually all that different."

reply via email to

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