emacs-devel
[Top][All Lists]
Advanced

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

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


From: Vinicius Jose Latorre
Subject: Re: request for a new function, say, `sequence'
Date: Fri, 04 Apr 2003 23:10:27 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312

Richard Stallman wrote:

Your code looks the cleanest; please install it.

Has someone updated etc/NEWS?


Done.  See the doc associated:

(defun number-sequence (from &optional to inc)
 "Return a sequence of numbers from FROM to TO (both inclusive) as a list.
INC is the increment used between numbers in the sequence.
So, the Nth element of the list is (+ FROM (* N INC)) where N counts from
zero.
If INC is nil, it defaults to 1 (one).
If TO is nil, it defaults to FROM.
If TO is less than FROM, the value is nil.
Note that FROM, TO and INC can be integer or float."
 (if (not to)
     (list from)
   (or inc (setq inc 1))
   (let (seq)
     (while (<= from to)
   (setq seq (cons from seq)
         from (+ from inc)))
     (nreverse seq))))






reply via email to

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