Hi Paul Paul Drummond a écrit : > (defmacro defwidget [& body] > `(let [panel# (javax.swing.JPanel.) > ~@(flat1 (map (fn [[type inst]] [inst (list type)]) (rest (first > body))))] > ~(second body) > (doto panel# > (.setLayout (javax.swing.BoxLayout. panel# > javax.swing.BoxLayout/Y_AXIS)) > (.add l) > (.add b)))) > >
The problem is with the last two lines of your macro (the let expansion is fine): (.add l) (.add b)))) Do you really want to hardcode l and b here or emit as many .add as required? (defmacro defwidget [& body] `(let [panel# (javax.swing.JPanel.) ~@(flat1 (map (fn [[type inst]] [inst (list type)]) (rest (first body))))] ~(second body) (doto panel# (.setLayout (javax.swing.BoxLayout. panel# javax.swing.BoxLayout/Y_AXIS)) ~@(for [[_ inst] (reverse (rest (first body)))] `(.add ~inst))))) Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---