Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "B. Pym" Newsgroups: comp.lang.lisp Subject: Re: sequence iteration Date: Mon, 23 Jun 2025 01:49:35 -0000 (UTC) Organization: A noiseless patient Spider Lines: 45 Message-ID: <103abre$vmdi$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Injection-Date: Mon, 23 Jun 2025 03:49:35 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d90ab8b8c308bf5aaf458d3b4e11365a"; logging-data="1038770"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sXiSCp1lXXvjcJL7GHbfL" User-Agent: XanaNews/1.18.1.6 Cancel-Lock: sha1:kO8Ju8JvVAyHnWq9xke8zYWW2yI= Don Geddis wrote: > > Is there any generic iteration contruct for sequences? Ideally it > > would work just like DOLIST. > > > (do-sequence (e "ab c") > > (print e)) > > #\a > > #\b > > #\Space > > #\c > > nil > > Well, I don't know if you consider the LOOP macro to be Common Lisp, but > the following works in Allegro CL 4.2: > > USER(20): (loop for x across "ab c" do (print x)) > > #\a > #\b > #\space > #\c > NIL > > CLtL2 says that the "across" keyword works for iteration over arrays (vectors), > so it looks to be not quite as generic as over sequences. But it's close. Gauche Scheme (use gauche.collection) (for-each print '(a b c)) a b c (for-each print #(a b c)) a b c (for-each print "abc") a b c