protocols and interfaces

2012-02-10 Thread drewn
I've just started learning protocols, deftype, etc. The first thing I did was try to extend a Clojure type (maps) to operate as a specialized Java Swing interface (AttributeSet), forgetting that interfaces are not protocols; i.e. (extend-type clojure.lang.PersistentArrayMap javax.swing.text.Att

Re: protocols and interfaces

2012-02-10 Thread drewn
> Nope, can't be done. Java interfaces can't do this. I'm glad I asked the question. Given that it can't be done, any suggestions for the best way of handling this interop scenario? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Re: protocols and interfaces

2012-02-10 Thread drewn
to pass in one argument as a map itself, but that seems to defeat the purpose.) On Feb 10, 10:32 am, Cedric Greevey wrote: > On Fri, Feb 10, 2012 at 1:07 PM, Aaron Cohen wrote: > > On Fri, Feb 10, 2012 at 3:13 AM, drewn wrote: > >> I've just started learning protocols, d

Re: clojurescript: how do i copy one input text field to another?

2011-12-18 Thread drewn
I had this problem too. I tried to do it in Pinot+Noir. Haven't figured it out yet, so curious to see if there's any success with this! On Dec 16, 1:05 pm, bob wrote: > here is a link to both:https://gist.github.com/1487157 > (hopefully that is what you meant by create a paste.  first time > tr

confusing macro issue: java.lang.InstantiationException

2012-01-20 Thread drewn
I've been trying to write a macro to generate predicates from maps, for instance the map {1 :one 2 :two} would define two predicates, one? and two? Here's the first part of the macro: (defmacro make-predicate [keyword-pair] `(defn ~(symbol (str (name (nth (eval keyword-pair) 1)) "?")) [~'x]

Re: confusing macro issue: java.lang.InstantiationException

2012-01-20 Thread drewn
Thank you, that works great! It's a nice use of destructuring too, which I should of thought of. I guess this is one case where solving the problem in pieces does not help. Actually, I seem to remember seeing idioms like that for other macros over sequences. I understand a little more now why.