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])))))
Is there a better way?
I'm sure I can improve the formatting by defining a couple of things in let
s or whatever.