Re: Implementing a clojure-only periodic timer...

2011-12-02 Thread Bill Caputo
On Dec 1, 2011, at 11:02 PM, Benny Tsai wrote: > Overtone's 'at-at' library is a thin Clojure wrapper over > ScheduledThreadPoolExecutor with a nice interface. I think you should be > able to build a timer on top of it pretty easily. > > https://github.com/overtone/at-at Thanks Benny; I went

Re: Implementing a clojure-only periodic timer...

2011-12-01 Thread Benny Tsai
Overtone's 'at-at' library is a thin Clojure wrapper over ScheduledThreadPoolExecutor with a nice interface. I think you should be able to build a timer on top of it pretty easily. https://github.com/overtone/at-at On Thursday, December 1, 2011 10:17:40 AM UTC-7, Bill Caputo wrote: > > Hi All,

Re: Implementing a clojure-only periodic timer...

2011-12-01 Thread Stuart Sierra
ScheduledThreadPoolExecutor is the way to go. But you can do it in "pure" Clojure with Agents, send-off, and Thread/sleep. -S -- 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 pos

Re: Implementing a clojure-only periodic timer...

2011-12-01 Thread Bill Caputo
On Dec 1, 2011, at 11:45 AM, gaz jones wrote: >Hey Bill, I would have thought you would have to have a pretty good >reason for not using an executor for this? Just that I really never spent much time as a Java programmer, so evaluating the merits/tradeoffs/gotchas of using native (and 3rd party)

Re: Implementing a clojure-only periodic timer...

2011-12-01 Thread gaz jones
Hey Bill, I would have thought you would have to have a pretty good reason for not using an executor for this? (let [executor (Executors/newSingleThreadScheduledExecutor)] (.scheduleAtFixedRate executor your-func 0 3 TimeUnit/SECONDS)) On Thu, Dec 1, 2011 at 11:17 AM, Bill Caputo wrote: > Hi A

Implementing a clojure-only periodic timer...

2011-12-01 Thread Bill Caputo
Hi All, I am currently considering an approach similar to the following for periodically sending an update to an agent and I'm looking for feedback on whether there is anything wrong with it, whether it's idiomatic clojure (sorry I'm in the pro-that-term camp) and whether there are other pure-cloj