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, 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 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 don't have to manage >>> anything regarding timing/pausing. >>> >>> /Linus >>> >>> >>> [1] https://github.com/AdamClements/schejulure >>> [2] https://github.com/overtone/at-at >>> >>> >>> 2014-09-11 13:52 GMT+02:00 Jeremy Vuillermet <jeremy.v...@gmail.com>: >>> >>>> 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 way is to use an atom pause?, >>>> check for the pause and block until a new value in a "resume" chan. >>>> >>>> But there may be an other way with channels only and avoid >>>> global/shared pause atom. >>>> I was naively thinking of a pause channel and at each loop I check if >>>> there is a value but I'm not sure it's better and I couldn't manage to do >>>> it anyway. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>>
-- 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.