Subject: Re: [newbie] iterate over chars?
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 22 Aug 2003 05:16:09 -0500
Newsgroups: comp.lang.lisp
Message-ID: <eAOdnS84irT0cNiiXTWc-w@speakeasy.net>
Frode Vatvedt Fjeld  <frodef@cs.uit.no> wrote:
+---------------
| "Dave" <uni512web@iol.it> writes:
| > Does a function of this kind exist?
| >>(defun remove-chars (clist chars)                     
...
| ... perhaps you should reconsider how you represent things.
| That said, your function is naturally expressed as
| 
|   (remove-if (lambda (c) (find (char c 0) "afd"))
|              (list "a" "b" "c" "a" "d" "e" "f"))
| 
| => ("b" "c" "e")
+---------------

Actually, since a string is a sequence too, what seems more natural
to me is:

	> (remove-if (lambda (c) (find c "afd"))
		     "abcadef")

	"bce"
	> 


-Rob

-----
Rob Warnock, PP-ASEL-IA		<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607