Re: timed termination of iterative algorithm

2011-07-31 Thread Jeff Palmucci
http://github.com/jpalmucci/clj-return-from On Jul 31, 12:41 pm, Sunil S Nandihalli wrote: > Hi Ken, >  thank you for your response. Do you think you can give me a quick example > of how to extend an Exception to be able to extract the value from the > exception when it is caught.. Should I be us

Re: timed termination of iterative algorithm

2011-07-31 Thread Ken Wesson
Another, perhaps cleaner method leverages more of Java's and Clojure's concurrency tools. (def res (atom nil)) (defn outer-loop [...] (loop [x initial-value ...] (reset! res x) (recur (compute-new-x x ...) ...))) ... (defn do-it [timeout ...] (let [f (future (outer-loop ...))] (

Re: timed termination of iterative algorithm

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 12:41 PM, Sunil S Nandihalli wrote: > Hi Ken, >  thank you for your response. Do you think you can give me a quick example > of how to extend an Exception to be able to extract the value from the > exception when it is caught.. Should I be using gen-class for this? (seems >

Re: timed termination of iterative algorithm

2011-07-31 Thread Sunil S Nandihalli
Hi Ken, thank you for your response. Do you think you can give me a quick example of how to extend an Exception to be able to extract the value from the exception when it is caught.. Should I be using gen-class for this? (seems quiet messy to me)... do you have a better suggestion.. Thanks, Sunil

Re: timed termination of iterative algorithm

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 10:25 AM, Sunil S Nandihalli wrote: > Hello everybody, >  I would like to have a long running process to return its current solution > after some pre-determined amount of time. It so happens that the iteration > is happening at a deeper nested function. I would like to have

timed termination of iterative algorithm

2011-07-31 Thread Sunil S Nandihalli
Hello everybody, I would like to have a long running process to return its current solution after some pre-determined amount of time. It so happens that the iteration is happening at a deeper nested function. I would like to have a way to return from this nested function when its time ... How can