>
> Hi,
>

I gave this a try over the weekend and then I do this it all works fine:

(import java.util.concurrent.ScheduledThreadPoolExecutor )
(import java.util.concurrent.TimeUnit)
(def executor (ScheduledThreadPoolExecutor. 1))

(defn my-func []
  (println "adsf" )
  (.schedule executor my-func 1 TimeUnit/SECONDS))

That prints out the line once a second, every second. But when I change my 
function so that it takes arguments, like this:

(defn my-func [id]
  (println id )
  (.schedule executor (my-func (inc id)) 1 TimeUnit/SECONDS))

I get a stackoverflow and the print out happen immediately, they are not 
scheduled. This is also the behaviour I got with the at-at library. I'd 
rather use something like the latter as it stops me from having mutable 
state inside my functions.

Any ideas?

Thomas 




 

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to