From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: request for a new function, say, `sequence' Date: Sun, 23 Mar 2003 12:02:39 +0900 (JST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200303230302.MAA04327@etlken.m17n.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1048388669 2597 80.91.224.249 (23 Mar 2003 03:04:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 23 Mar 2003 03:04:29 +0000 (UTC) Cc: kawabata@m17n.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Mar 23 04:04:27 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 18wvmd-0000fl-00 for ; Sun, 23 Mar 2003 04:04:27 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18wvp8-0004Wb-00 for ; Sun, 23 Mar 2003 04:07:02 +0100 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 18wvlb-0007Gb-05 for emacs-devel@quimby.gnus.org; Sat, 22 Mar 2003 22:03:23 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18wvl7-0006kX-00 for emacs-devel@gnu.org; Sat, 22 Mar 2003 22:02:53 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18wvkx-00069T-00 for emacs-devel@gnu.org; Sat, 22 Mar 2003 22:02:45 -0500 Original-Received: from tsukuba.m17n.org ([192.47.44.130]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18wvkv-0005xF-00 for emacs-devel@gnu.org; Sat, 22 Mar 2003 22:02:41 -0500 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2])h2N32d916856; Sun, 23 Mar 2003 12:02:39 +0900 (JST) (envelope-from handa@m17n.org) Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) h2N32dA07544; Sun, 23 Mar 2003 12:02:39 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id MAA04327; Sun, 23 Mar 2003 12:02:39 +0900 (JST) Original-To: emacs-devel@gnu.org User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) 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:12540 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12540 In the Indian languages support, we use this kind of function repeatedly. But, the function itself is generic enough to be used in the other cases. Can I install it in subr.el (or simple.el)? (defun sequence (from to type) "Return a sequence of type TYPE that contains numbers FROM to TO (inclusive). TYPE must `list', `vector', or `string'. If TYPE is `string', all numbers between FROM and TO must be valid characters." (let ((len (1+ (- to from))) val) (if (>= len 0) (cond ((eq type 'list) (while (>= to from) (setq val (cons to val) to (1- to)))) ((eq type 'vector) (setq val (make-vector len 0)) (while (>= to from) (aset val (- to from) to) (setq to (1- to)))) ((eq type 'string) (setq val (make-string len 0)) (while (>= to from) (aset val (- to from) to) (setq to (1- to)))) (t (error "Invalid type: %s" type)))) val)) --- Ken'ichi HANDA handa@m17n.org