From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: request for a new function, say, `sequence' Date: Thu, 03 Apr 2003 17:52:18 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <200303230302.MAA04327@etlken.m17n.org> <200303241541.h2OFfbpa011227@rum.cs.yale.edu> <200303250015.JAA06592@etlken.m17n.org> <200303250050.JAA06631@etlken.m17n.org> <200303250057.h2P0vBj6016367@rum.cs.yale.edu> <200303250125.KAA06703@etlken.m17n.org> <32627.1048557446@theforce.Stanford.EDU> <200303250208.LAA06802@etlken.m17n.org> <1191.1048560083@theforce.Stanford.EDU> <200303250446.NAA06974@etlken.m17n.org> <4946.1048568708@theforce.Stanford.EDU> <200303261218.VAA09242@etlken.m17n.org> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1049730397 13953 80.91.224.249 (7 Apr 2003 15:46:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 7 Apr 2003 15:46:37 +0000 (UTC) Cc: handa@m17n.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Apr 07 17:46:36 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 192YpQ-0003cu-00 for ; Mon, 07 Apr 2003 17:46:36 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 192Ysz-0001k3-00 for ; Mon, 07 Apr 2003 17:50:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192YlV-0008ML-02 for emacs-devel@quimby.gnus.org; Mon, 07 Apr 2003 11:42:33 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 192YeY-0006Lm-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 11:35:22 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 192YcM-0005Eq-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 11:33:06 -0400 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192YYR-0003fj-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 11:29:03 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.10) id 191DZC-0006od-00; Thu, 03 Apr 2003 17:52:18 -0500 Original-To: Miles Bader In-reply-to: (message from Miles Bader on 03 Apr 2003 12:44:46 +0900) Original-cc: ttn@glug.org Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12958 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12958 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))) seq)) That is much cleaner. However, to do the right thing with floats, it should count up from FROM and then call nreverse.