From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Francis Moreau Newsgroups: gmane.emacs.help Subject: Basic questions about elisp Date: Thu, 5 Nov 2009 03:13:32 -0800 (PST) Organization: http://groups.google.com Message-ID: <1e9f8449-09ec-4a84-a332-9f05fadb8aa3@z41g2000yqz.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1257421446 32150 80.91.229.12 (5 Nov 2009 11:44:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Nov 2009 11:44:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 05 12:43:59 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N60kv-0005CC-Bu for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Nov 2009 12:43:58 +0100 Original-Received: from localhost ([127.0.0.1]:55993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N60ku-0002o9-KQ for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Nov 2009 06:43:56 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!z41g2000yqz.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 213.41.232.205 Original-X-Trace: posting.google.com 1257419612 16819 127.0.0.1 (5 Nov 2009 11:13:32 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 5 Nov 2009 11:13:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z41g2000yqz.googlegroups.com; posting-host=213.41.232.205; posting-account=ekTE0goAAADiVCThPmo4ph0C5bTUhQOx User-Agent: G2/1.0 X-HTTP-Via: 1.1 grimoire.wyplay.int:3128 (squid/2.5.STABLE14) X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.11) Gecko/2009061118 Fedora/3.0.11-1.fc9 Firefox/3.0.11, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:174407 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69485 Archived-At: 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