Re: Pause a go loop

2014-09-14 Thread Jeremy Vuillermet
That's what I came up with. alts is very powerfull ! thanks On Friday, September 12, 2014 11:56:56 PM UTC+2, Dylan Butman wrote: How about this? https://gist.github.com/pleasetrythisathome/4f03ba9f729300beea40 On Friday, September 12, 2014 12:51:39 PM UTC-4, Jeremy Vuillermet wrote: thx,

Re: Pause a go loop

2014-09-12 Thread Jeremy Vuillermet
thx, I'll look more into in but it doesn't seem they are able to pause and resume scheduled functions On Thursday, September 11, 2014 4:34:16 PM UTC+2, Linus Ericsson wrote: For instance you can use schejulure [1] or at-at [2] and make sure the scheduled function calls put an item (event) on

Re: Pause a go loop

2014-09-12 Thread Dylan Butman
How about this? https://gist.github.com/pleasetrythisathome/4f03ba9f729300beea40 On Friday, September 12, 2014 12:51:39 PM UTC-4, Jeremy Vuillermet wrote: thx, I'll look more into in but it doesn't seem they are able to pause and resume scheduled functions On Thursday, September 11, 2014

Pause a go loop

2014-09-11 Thread Jeremy Vuillermet
Hello, here is my use case (defn replay [history] (go (doseq [millis history] (! (timeout millis)) (prn millis history is a vector of duration: [1000 2000 4000] Now I would like to pause this doseq. One

Re: Pause a go loop

2014-09-11 Thread Linus Ericsson
For instance you can use schejulure [1] or at-at [2] and make sure the scheduled function calls put an item (event) on the channel and then made the scheduler do the pausing work. All the listeners attached to the channel will receive the events at the time the scheduler releases them, and you

Re: Pause a go loop

2014-09-11 Thread Alex Miller
You should never block a go loop other than by using a parking channel op (like !, !, etc). You probably instead want a control channel where you can send it a pause message telling it to block on the control channel until a resume message arrives. On Thursday, September 11, 2014 6:52:48 AM

Re: Pause a go loop

2014-09-11 Thread Jeremy Vuillermet
Yes when I write block I meant park. My first idea was to use a control channel which have pause and resume input but then my question is ! control-channel would park until a value is available, what if I want to continue is there is nothing ? On Thursday, September 11, 2014 4:39:51 PM UTC+2,