From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ian Zimmerman Newsgroups: gmane.emacs.help Subject: Re: looping over characters in a string in elisp? Date: 28 Dec 2002 16:33:06 -0800 Organization: http://extra.newsguy.com Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <8665tdbr5p.fsf@kronstadt.homeunix.net> References: <84bs38hj8l.fsf@lucy.cs.uni-dortmund.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1041123335 5209 80.91.224.249 (29 Dec 2002 00:55:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 29 Dec 2002 00:55:35 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18SRjq-0001Lr-00 for ; Sun, 29 Dec 2002 01:55:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18SRji-0007PF-00 for gnu-help-gnu-emacs@m.gmane.org; Sat, 28 Dec 2002 19:55:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!HSNX.atgi.net!cyclone-sf.pbi.net!129.250.175.17!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews4 Original-Newsgroups: gnu.emacs.help Original-Lines: 24 Original-NNTP-Posting-Host: p-366.newsdawg.com User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:108566 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5095 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5095 >> (while char in string (do stuff) ) Kai> Why does it have to be a while loop? Why is a map-like look not Kai> enough? Kai> (mapcar (lambda (c) (char-to-string c)) "foobar") Kai> This calls the lambda expression on each character and collects Kai> the results in a list. You can throw the result away if you Kai> don't like it... I can remember the time(s) when I had forgotten enough about Emacs Lisp that I wanted to ask this question. I always checked myself in time and found the answer, but I think this is (a little bit of) evidence that TFM needs a simple improvement. Just put "STRINGS ARE ARRAYS" in big fat font at the beginning of the Strings section (which precedes the Sequences Arrays Vectors section). -- Ian Zimmerman, Oakland, California, U.S.A. if (sizeof(signed) > sizeof(unsigned) + 4) { delete this; } GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087