Converting proxy to a macro

2012-03-27 Thread Adam Markham
Hi, I am new to macros in general but am having a hard time trying to make a macro that wraps proxy. I am trying to convert the following: (proxy [java.util.Observer] [] (update [o arg] (println arg))) Is what i originally have but I want to convert it using a macro to: (observer java.uti

Re: Converting proxy to a macro

2012-03-27 Thread Rostislav Svoboda
> If anyone could help that would be great. try to start with writing a function like: user=> (def code '(proxy [java.util.Observer] [] (update [o arg] (println arg #'user/code user=> (cons 'observer (list (first (first (next code))) (next (next code))) ) (observer java.util.Observer ([] (upd

Re: Converting proxy to a macro

2012-03-27 Thread Rostislav Svoboda
user=> (def c1 '(proxy [java.util.Observer] [] (update [o arg] (println arg #'user/c1 user=> (def c2 (list (first (first (next c1))) (next (next c1 #'user/c2 user=> (def c3 (first (next c2))) #'user/c3 user=> (def c4 (first (next c3))) #'user/c4 user=> (cons 'observer (list (first c2) [] c4