If your code does not grow beyond what you show us, it seems like a
good compromise.

If you want to be more DRY, here's my take:

(defn add-components! [composite components]
  (doseq [component components] (.addComponent composite component)))

(defn -init [this]
  (let [app this]
    (.setMainWindow this
      (doto (Window. "Test application")
        (add-components! (Label. "Hello!") (Button. "button"))))))

2011/6/23 Antonio Recio <amdx6...@gmail.com>:
> I would like to use only one time ".addComponent" and don't repeat it each
> time that I need to add something. How I can do it? Perhaps with doto? Are
> there other way? It is possible to optimize it more?
> (defn -init [this]
>   (let [app this]
>     (.setMainWindow this
>       (doto (Window. "Test application")
>         (.addComponent (Label. "Hello!"))
>         (.addComponent (Button. "button"))))))
>
> --
> 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
> Note that posts from new members are moderated - please be patient with your
> first post.
> 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

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to