(loop
for element in sequence
collect (do-something-to element)
until (> element 5))
This performs some action on each element (do-something-to) and
collects the results in a list (the return value of loop). If it runs
into an element that is greater than 5, it will terminate early and
return whatever it collected so far.
(use srfi-42) ;; list-ec for Gauche Scheme.
or
(require srfi/42) ;; list-ec for Racket.
(define nums '(-8 0 4 6 9))
(list-ec (:until (:list x nums) (> x 5)) (abs x))
(8 0 4 6)
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)