Re: Putting in alts! - haven't seen it used

2013-09-09 Thread Cedric Greevey
Sounds like that could be useful for gracefully degrading media players. Playback lags due to CPU contention or whatever, drop a frame to keep the audio and video and clock-time roughly in proper sync. Things like that. On Mon, Sep 9, 2013 at 9:09 AM, Philip Potter wrote: > I can suggest one, th

Re: Putting in alts! - haven't seen it used

2013-09-09 Thread Philip Potter
I can suggest one, though I haven't used it for real so can't speak for all the design tradeoffs: (alts! [[out val] (timeout N)]) will attempt to write to a consumer, but if the consumer is swamped, will drop the message on the floor and move on. (I can imagine rewriting this using alt! so that i

Re: Putting in alts! - haven't seen it used

2013-09-09 Thread Timothy Baldridge
Or just have multiple takers from the same channel, here's the code I normally use: (def c (let [c (chan 4)] (dotimes [x 4] (go (loop [] (when-let [v (! c "data") With a large enough queue size, you'd get all the benefits you mentioned (the pr

Re: Putting in alts! - haven't seen it used

2013-09-09 Thread Cedric Greevey
It sounds possibly useful for a form of "load balancing". You have a producer put onto any of several channels, each with a consumer. If some consumers are backlogged the put will go to one that isn't backlogged, instead of blocking, if there's a consumer available. For a CPU-bound task where the c

Re: Putting in alts! - haven't seen it used

2013-09-08 Thread Sean Corfield
Ah, I missed the 'put' part of it. No, haven't used that aspect yet. On Sun, Sep 8, 2013 at 10:09 PM, Timothy Baldridge wrote: > He's talking about puts and alts. You can actually do multiple puts at once > inside an alts! and only one of them will be used. Yes I haven't seen them > used either,

Re: Putting in alts! - haven't seen it used

2013-09-08 Thread Timothy Baldridge
He's talking about puts and alts. You can actually do multiple puts at once inside an alts! and only one of them will be used. Yes I haven't seen them used either, I'm sure there's a use case, I haven't found it yet though. Timothy On Sun, Sep 8, 2013 at 9:35 PM, Sean Corfield wrote: > We're us

Re: Putting in alts! - haven't seen it used

2013-09-08 Thread Sean Corfield
We're using alts! to take a value or timeout, as part of machinery to detect whether a popup opens or is blocked. On Sun, Sep 8, 2013 at 7:21 PM, Alan Shaw wrote: > I'm accustomed to using alts! to allow taking from a collection of > core.async ports, but haven't come up with a use case for a put

Putting in alts! - haven't seen it used

2013-09-08 Thread Alan Shaw
I'm accustomed to using alts! to allow taking from a collection of core.async ports, but haven't come up with a use case for a put in alts!, either with or without takes. Have you? -A -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi