unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Basic questions about elisp
@ 2009-11-05 11:13 Francis Moreau
  2009-11-05 11:50 ` Lennart Borgman
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Francis Moreau @ 2009-11-05 11:13 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I'm trying to learn elisp and have a couple of basic questions.

I'm iterating over a list using dotimes, but in the body of dotimes,
the list can mutate. For example I have:

  (dolist (elt lst)
    ;; some codes
    (nconc lst '(2)))

This adds/appends a new element to 'lst' list. It looks like 'dotimes'
doesn't like it.

So I eventually wrote it like this

    (setq i 0)
    (while (< i (length lst))
          ;; some codes
          (x-nconc lst '(2))))
      (setq i (1+ i)))

which is a bit ugly, is there another way to do that ?

I also need to iterate over elements of a vector.  I basically use a
'while' loop as above. Is there any helper to do that, I looked at
"(elisp) Sequences Arrays Vectors" but found nothing appropriate.

And finally, is it the good place to ask such questions about elisp ?

Thanks


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

end of thread, other threads:[~2009-11-10 18:53 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-05 11:13 Basic questions about elisp Francis Moreau
2009-11-05 11:50 ` Lennart Borgman
     [not found] ` <mailman.10118.1257421858.2239.help-gnu-emacs@gnu.org>
2009-11-05 12:07   ` Francis Moreau
2009-11-05 12:44     ` Lennart Borgman
2009-11-05 12:59     ` David Kastrup
2009-11-05 14:25       ` Francis Moreau
2009-11-05 14:37         ` Pascal J. Bourguignon
2009-11-05 14:58     ` Pascal J. Bourguignon
2009-11-05 12:57 ` tomas
     [not found] ` <mailman.10122.1257425638.2239.help-gnu-emacs@gnu.org>
2009-11-05 14:29   ` Francis Moreau
2009-11-05 14:41 ` Pascal J. Bourguignon
2009-11-05 15:06   ` David Kastrup
2009-11-06 16:03     ` Francis Moreau
2009-11-06 16:49       ` David Kastrup
2009-11-06 20:53         ` Francis Moreau
2009-11-06 21:18           ` Pascal J. Bourguignon
2009-11-07 14:49             ` Francis Moreau
2009-11-07 17:50               ` Pascal J. Bourguignon
2009-11-08  9:46               ` tomas
     [not found]               ` <mailman.10266.1257674088.2239.help-gnu-emacs@gnu.org>
2009-11-09 20:51                 ` Francis Moreau
2009-11-08 15:18             ` Francis Moreau
2009-11-08 16:58               ` tomas
2009-11-08 17:12               ` Pascal J. Bourguignon
2009-11-09 21:04                 ` Francis Moreau
2009-11-10 12:11                   ` Joost Kremers
2009-11-10 14:16                     ` Francis Moreau
2009-11-10 18:53                       ` David Kastrup
2009-11-06  5:06   ` Barry Margolin

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).