[Top][All Lists]

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

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

From: Kenichi Handa
Subject: Re: request for a new function, say, `sequence'
Date: Tue, 25 Mar 2003 10:25:18 +0900 (JST)
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)

In article <address@hidden>, "Stefan Monnier" <monnier+gnu/address@hidden> 
>>  (dolist (c (sequence #X #Y 'list))
>>    ..operate-on-C)

> I agree that such code is pretty common, but I'd rather extend dotimes
> to allow something like (dotimes (c (cons X Y)) BODY).

I'm not sure it is a good idea to extend dotimes and make it
different from Commong Lisp.  And, using `sequence' is more
flexible, for instance, in the following case.

  ;; Combining diacritics
  (setq c #x300)
  (while (<= c #x362)
    (modify-category-entry (decode-char 'ucs c) ?^)
    (setq c (1+ c)))

  ;; Combining marks
  (setq c #x20d0)
  (while (<= c #x20e3)
    (modify-category-entry (decode-char 'ucs c) ?^)
    (setq c (1+ c)))

can be:

  (dolist (c (append (sequence #x0300 #x0362 'list)
                     (sequence #x20d0 #x20e3 'list)))
    (modify-category-entry (decode-char 'ucs c) ?^)

Of course, in this specific case, allowing FROM and TO in
modify-category-entry is better.

Ken'ichi HANDA

reply via email to

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