in clojure I'm using the following function to initialize a 2d vector:
(defn vec2d [x y init]
(vec (map
#(vec (map init (range x))) (range y))))
usage:
(def grid (vec2d 40 30 (fn [] "x")))
Since I'm new to the language, I ask myself if this is the most straight-forward way to do so. Has anyone an idea to optimize this?