rewrites lazy-seq style iteration as explicit loop/recur with guard