unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* request for a new function, say, `sequence'
@ 2003-03-23  3:02 Kenichi Handa
  2003-03-24 15:41 ` Stefan Monnier
  0 siblings, 1 reply; 49+ messages in thread
From: Kenichi Handa @ 2003-03-23  3:02 UTC (permalink / raw)
  Cc: kawabata

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2003-04-08  8:10 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-23  3:02 request for a new function, say, `sequence' Kenichi Handa
2003-03-24 15:41 ` Stefan Monnier
2003-03-25  0:15   ` Kenichi Handa
2003-03-25  0:50     ` Kenichi Handa
2003-03-25  0:57       ` Stefan Monnier
2003-03-25  1:25         ` Kenichi Handa
2003-03-25  1:47           ` Luc Teirlinck
2003-03-25  1:51             ` Luc Teirlinck
2003-03-25  1:59             ` Kenichi Handa
2003-03-25  2:29               ` Luc Teirlinck
2003-03-25  1:57           ` Satyaki Das
2003-03-25  2:08             ` Kenichi Handa
2003-03-25  2:41               ` Satyaki Das
2003-03-25  4:46                 ` Kenichi Handa
2003-03-25  5:05                   ` Satyaki Das
2003-03-25  5:40                     ` Kenichi Handa
2003-03-25 20:10                       ` Satyaki Das
2003-03-26  0:18                         ` Kenichi Handa
2003-03-26  1:44                           ` Satyaki Das
2003-03-26  2:38                           ` Luc Teirlinck
2003-03-26  7:31                             ` Edward O'Connor
2003-03-26  8:48                               ` Thien-Thi Nguyen
2003-03-26 12:18                                 ` Kenichi Handa
2003-03-27  3:30                                   ` Richard Stallman
2003-04-03  2:54                                     ` Kenichi Handa
2003-04-03  3:44                                       ` Miles Bader
2003-04-03 22:52                                         ` Richard Stallman
2003-04-03 10:41                                       ` Thien-Thi Nguyen
2003-04-04  2:11                                         ` Vinicius Jose Latorre
2003-04-04 22:23                                           ` Richard Stallman
2003-04-05  2:10                                             ` Vinicius Jose Latorre
2003-04-06  2:00                                               ` Richard Stallman
2003-04-08  8:10                                               ` Kenichi Handa
2003-04-03 22:52                                       ` Richard Stallman
2003-03-25 15:27                   ` Stefan Monnier
2003-03-25 23:11                     ` Kenichi Handa
2003-03-26  0:11                       ` Miles Bader
2003-03-26  0:40                         ` Luc Teirlinck
2003-03-26  1:34                           ` Miles Bader
2003-03-26  0:54                         ` Kenichi Handa
2003-03-26  1:29                           ` Miles Bader
2003-03-26 15:44                       ` Stefan Monnier
2003-03-27  0:09                         ` Luc Teirlinck
2003-03-27 15:20                           ` Stefan Monnier
2003-03-27 15:53                             ` Luc Teirlinck
2003-03-27 16:06                               ` Stefan Monnier
2003-03-27 17:03                                 ` Luc Teirlinck
2003-03-27 17:08                                   ` Stefan Monnier
2003-03-26  2:41               ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).