Hi, Linus Björnstam <linus.inter...@fastmail.se> writes: > The syntax is more or less the same as racket's loops, and they are generally > compatible. The code generated is for almost all cases as fast as hand-rolled > code. They are all expressed as left or right folds, and are as such (apart > from for/list, but read about that in the documentation) free of mutation. > They are all converted to named lets.
That’s cool! > (define (erathostenes n) > (define vec (make-vector n #t)) > (for/list ([i (in-range 2 n)] #:when (vector-ref vec i)) > (for ([j (in-range/incr (* 2 i) n i)]) > (vector-set! vec j #f)) > i)) > > The code and documentation is available here: > https://hg.sr.ht/~bjoli/guile-for-loops Is there a chance that this could get included in Guile (ice-9 for-loops?) and become a SRFI? If the code is non-portable (I guess the #:keywords are), the two existing implementations (Racket, Guile) would still be sufficient for a SRFI. Best wishes, Arne -- Unpolitisch sein heißt politisch sein ohne es zu merken