From Newsgroup: comp.lang.scheme
Novus wrote:
(loop :for n :from 1
:for form = (read s nil s)
:until (eq form s)
:collect (make-instance 'foo :src form)
:until (and count (<= count n)))
Or if you like loops that look more like lisp than loop:
(iter (for form in-stream s)
(for n upfrom 0)
(until (and count (<= count n)))
(collect (make-instance 'foo :src form))))
Gauche Scheme
(use gauche.generator)
(define count 3)
(map (^(form) (list 'foo form))
(generator->list read (or count +inf.0)))
1 2 3 4
((foo 1) (foo 2) (foo 3))
gosh> 4
--
[T]he problem is that lispniks are as cultish as any other devout group and basically fall down frothing at the mouth if they see [heterodoxy].
--- Kenny Tilton
The good news is, it's not Lisp that sucks, but Common Lisp. --- Paul Graham --- Synchronet 3.21a-Linux NewsLink 1.2