(chibi loop)

The loop API is mostly compatible with Taylor Campbell's foof-loop, but the iterator API is different and subject to change.

(loop [name] (vars ...) [=> result] body ...)

(for ((vars ...) ...) body ...)

(for lp ((vars ...) ...) body ...)

Utility syntax for the common case of a loop which has only for clauses.

Iterators

(for var [pair] (in-list ls [cdr]))

Basic list iterator.

(for elts [pairs] (in-lists lol [cdr [done?]]))

Iterator from Taylor R. Campbell. If you know the number of lists ahead of time it's much more efficient to iterate over each one separately.

(define-in-indexed in-type in-type-reverse length ref)

(for var [index] (in-vector vec))

(for var [index] (in-vector-reverse vec))

(for ch [cursor] (in-string str))

(for ch [cursor] (in-string-reverse str))

(for ch (in-port [input-port [reader [eof?]]]))

(for ch (in-file [input-port [reader [eof?]]]))

(for x (up-from [start] [(to limit)] [(by step)]))

(for x (down-from [start] [(to limit)] [(by step)]))

(for x [pair] (listing expr))

(for x [pair] (listing-reverse expr))

(for x [pair] (appending expr))

(for x [pair] (appending-reverse expr))

(for x (summing expr))

(for x (multiplying expr))