code-reviews

2016-08-19T21:48:43.000014Z

I'm generating a grid as a two-dimensional array. I've got two equivalent functions, which both look awful:

(defn grid-mapv [w h]
  (mapv
    (fn [x]
      (mapv
        (fn [y] [x y])
        (range 0 w)))
    (range 0 h)))

(defn grid-for [w h]
 (into [] (for [x (range 0 w)]
            (into [] (for [y (range 0 h)]
                       [x y])))))

2016-08-19T21:48:49.000015Z

Is there a better way?

2016-08-19T21:49:11.000016Z

I'm sure I can improve the formatting by defining a couple of things in lets or whatever.