Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sequence iteration

4 views
Skip to first unread message

Robert L.

unread,
Dec 9, 2017, 3:30:55 PM12/9/17
to
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.


(require srfi/13)
(string-for-each writeln "ab c")

#\a
#\b
#\space
#\c

--
One of [the Zionists'] streams of output ... tells everyone else they should
mix together ...; and the other stream of output is ... for internal
consumption, and that says an entirely different and much more healthy thing:
that Jews should intermarry with other Jews....
http://archive.org/details/nolies
0 new messages