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 '(time-limited 100 (println "Hello World"))) it expands
to:
(let* [f__1760__auto__ (clojure.core/future (println "Hello"))] (.get
f__1760__auto__ 100 java.util.concurrent.TimeUnit/MILLISECONDS))
My questions are:
1) Where does the let* come from?!?
2) Why does f need to be a auto generated variable? Wouldn't (let* [f
(clojure.core/future (println "Hello"))] (.get f 100
java.util.concurrent.TimeUnit/MILLISECONDS)) suffice?
3) What's .get ??
Cheers
Andreas
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en