Can you help me refactor this piece of clojure code to produce a seq?

Posted by ique on Stack Overflow See other posts from Stack Overflow or by ique
Published on 2010-12-25T17:57:15Z Indexed on 2010/12/25 19:54 UTC
Read the original article Hit count: 168

Filed under:
|

I want to produce a seq that I can later do a (map) over. It should look like this:

((0 0) (0 1) (0 2) (0 3) ... (7 7))

The piece of code I have to do it right now seems very, very ugly to produce such a simple result. I need some help getting this straight.

(loop [y 0 x 0 args (list)]  
  (if (and (= y 7) (= x 7))  
    (reverse (conj args (list y x)))  
    (if (= x 7)  
    (recur (+ y 1) 0 (conj args (list y x)))  
    (recur y (+ x 1) (conj args (list y x))))))  

© Stack Overflow or respective owner

Related posts about refactoring

Related posts about clojure