[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Basic questions about elisp
From: |
Francis Moreau |
Subject: |
Basic questions about elisp |
Date: |
Thu, 5 Nov 2009 03:13:32 -0800 (PST) |
User-agent: |
G2/1.0 |
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
- Basic questions about elisp,
Francis Moreau <=
Re: Basic questions about elisp, tomas, 2009/11/05
Message not available
Re: Basic questions about elisp, Pascal J. Bourguignon, 2009/11/05