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: Satyaki Das
Subject: Re: request for a new function, say, `sequence'
Date: Mon, 24 Mar 2003 18:41:23 -0800

Kenichi Handa <address@hidden> writes:

> In article <address@hidden>, "Satyaki Das" <address@hidden> writes:
> 
> > If I were you I would be using loop as follows:
> 
> >    ;; Combining diacritics
> >    (loop for c from #x300 to #x362
> >          do (modify-category-entry (decode-char 'ucs c) ?^))
> 
> > Is there any particular reason for loop to be avoided? It is a
> > macro in CL, so it gets expanded at compile time. I ask since I
> > have used it in MH-E.
> 
> The above is an example usage of `sequence' (or `range'),
> not the reason of requesting this function.  The original
> reason is that there are cases that we need a list generated
> by this function.

The examples in this thread have all created a list (or vector)
and then iterated over the elements. The loop macro is ideal for
this (and more efficient since it doesn't cons up a list -- though
efficiency shouldn't be an issue). That is why I suggested this.

Are there lots of places where just a list of ascending numbers
needs to be returned?

> And, as far as I remember, it should be avoided to require
> `cl' in a preloaded file if possible.  Is this rule changed
> now?

Using `loop' requires cl at compile time only. So adding the
following line is sufficient:

  (eval-when-compile (require 'cl))

If the preloaded file is compiled then 'cl isn't actually loaded
at run time.

Satyaki




reply via email to

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