2010-06-02 Second Clojure Attempt

I’m trying to implement something like GridMapper using Clojure. The software appears to be simple to use, and requires a GUI. I know nothing of Clojure, very little Java, and nothing about Swing. A perfect setup to learn the new language. Let’s go! 😄

GridMapper

Some googling showed me the way to Heating Up Clojure & Swing by Stuart Sierra. Unfortunately I still have problems generating a 20 × 20 grid. Because I seem to be incapable of building lists the way I’m used to do it:

Heating Up Clojure & Swing

(let (result)
  (dotimes (x 20)
    (setq result (cons x (cons :gridx result)))
    (dotimes (y 20)
      (setq result (cons '(empty-tile) (cons y (cons :gridy result))))))
  (apply 'grid-bag-layout (nreverse result)))

Or is there a simpler solution not using Stuart’s grid-bag-layout?

​#Clojure