Try this syntax: ~'link

Cheers,

Telman

On Feb 23, 3:25 pm, max3000 <maxime.lar...@gmail.com> wrote:
> Hi,
>
> I'm new to lisp and clojure, so what follows may be a very easy (i.e.
> stupid) question...
>
> I want a macro to generate multi-methods. Here is the macro I crafted:
>
> (defmacro mcf [type class set-expr & forms]
>   '(defmethod make ~type [fd controller]
>      (let [control (new ~class)]
>        (doto control
>          ~@(map (fn [f] f) forms)
>          (~set-expr (. controller link control (:uid fd)))))))
>
> For instance, I want this:
> (mcf :String JTextField .setText (.setColumns 15) (.setEditable
> false))
>
> To generate this:
>
> (defmethod make :String [fd controller]
>   (let [control (new JTextField)]
>     (doto control
>       (.setColumns 15)
>       (.setEditable false)
>       (.setText (. controller link control (:uid fd))))))
>
> For some reason, controller, link, control and fd don't seem to be
> handled properly. No matter what escaping I try (quotes, semi-quotes),
> I always get some error similar to "No such var: clojure.core/link".
>
> Clojure seems to think "link" is a variable in the namespace while it
> is in fact a (java) method on the controller. I just want to output
> the last part verbatim (. controller link control...), I want no ahead-
> of-time dereferencing...
>
> What am I missing? Is it even possible?
>
> Thanks,
>
> Max
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to