Groups | Search | Server Info | Login | Register
Groups > comp.lang.scheme > #6522
| From | "B. Pym" <Nobody447095@here-nor-there.org> |
|---|---|
| Newsgroups | comp.lang.lisp, comp.lang.scheme |
| Subject | Re: loop with an optional limit? |
| Date | 2025-07-19 20:55 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <105h0ns$2ujql$1@dont-email.me> (permalink) |
Cross-posted to 2 groups.
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
Back to comp.lang.scheme | Previous | Next | Find similar
Re: loop with an optional limit? "B. Pym" <Nobody447095@here-nor-there.org> - 2025-07-19 20:55 +0000
csiph-web