Re: Help understanding macro

2011-02-09 Thread Ken Wesson
On Thu, Feb 10, 2011 at 12:06 AM, Andreas Kostler wrote: > Hi Ken, > Thanks again. However, I still have one nagging gap in understanding this > macro. > If I replace > > (defmacro time-limited [ms & body] >  `(let [f# (future ~@body)] >    (. get f# ~ms java.util.concurrent.TimeUnit/MILLISECONDS

Re: Help understanding macro

2011-02-09 Thread Andreas Kostler
Hi Ken, Thanks again. However, I still have one nagging gap in understanding this macro. If I replace (defmacro time-limited [ms & body] `(let [f# (future ~@body)] (. get f# ~ms java.util.concurrent.TimeUnit/MILLISECONDS))) which expands to: (macroexpand-1 '(time-limited 1000 (println "H

Re: Help understanding macro

2011-02-09 Thread Ken Wesson
On Wed, Feb 9, 2011 at 6:07 AM, Andreas Kostler wrote: > Hello all, > I've come across the following macro, which basically tries to execute body > and times out after ms milliseconds. It works fine :) > > (defmacro time-limited [ms & body] >  `(let [f# (future ~@body)] >     (. get f# ~ms java.u

Help understanding macro

2011-02-09 Thread Andreas Kostler
Hello all, I've come across the following macro, which basically tries to execute body and times out after ms milliseconds. It works fine :) (defmacro time-limited [ms & body] `(let [f# (future ~@body)] (. get f# ~ms java.util.concurrent.TimeUnit/MILLISECONDS))) If I do a (macroexpand '(