Thanks very much. :-D On Wednesday, 19 February 2014 17:43:16 UTC, tbc++ wrote: > > Yes, this pattern is pretty common. Create the timeout first, then do some > work, then take from the timeout to wait for the remaining time. Looks good > to me. > > Timothy > > > On Wed, Feb 19, 2014 at 10:27 AM, Kris Jenkins > <krisaj...@gmail.com<javascript:> > > wrote: > >> Hey folks, >> >> Can someone sanity check this for me, please? >> >> I want to write some code that processes messages on a core.async >> channel, at a rate of *at most* 1 message per second. I'm using this >> code: >> >> (go >> (while true >> (let [t (timeout 1000)] >> (log "Message is: " (<! my-interesting-channel)) >> (<! t)))) >> >> I'm expecting the timeout channel to start ticking down at the top. We >> process one message, and then iff that took less than 1s, the timeout >> channel will parse for the remaining milliseconds. >> >> It seems right to me, but I'd appreciate a second look, if someone can >> spare the time. :-) >> >> Cheers, >> Kris >> >> -- >> 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<javascript:> >> 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 <javascript:> >> 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 <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > “One of the main causes of the fall of the Roman Empire was that–lacking > zero–they had no way to indicate successful termination of their C > programs.” > (Robert Firth) >
-- 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/groups/opt_out.