Scheme’s DO is generally treated with some disdain. Yet I often find myself recreating it with named LET.
So,
(let next ([i 0] [res '()])
(if (= i 4)
res
(next (+ i 1) (cons i res))))
Is equivalent to:
(do ([i 0 (+ i 1)]
[res '() (cons i res)])
[(= i 4) res])
Advertisement