There may be a mismatch between the way you approach the problem and the
way the library is intended to be used. core.async channels do not "do"
anything, they are really just conveying belts, or tubes. You put something
on one end and someone else takes it up from the other end.

If you want a consumer that waits for some time, you may for example use a
loop that first waits on a timeout channel, and then takes from the "real"
channel.

If you want to wait until you have a given number of elements to do
something, again, I would advise doing that in the consumer: it can easily
accumulate in a local variable (e.g. in the arguments to the go-loop call)
the elements you get from the channel, and act on them when you have enough.

Or you can build a pipeline of two channels, with an intermediate go block
that accumulates elements from the first channel and puts a vector of n
elements on the second channel, if you want to decouple the accumulation
part from the actual processing.

You can probably check if a channel is full with offer!, but I doubt that
will be an easy idiom, especially if you want to do that checking from the
consumer.


On Thursday, 18 February 2016, Punit Naik <naik.puni...@gmail.com> wrote:

> I want to create a clojure aync channel which will do a specific task
> after its fully filled to its capacity or after a certain amount of time
> since its activation. How do I do this?
>
> --
> 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
> <javascript:_e(%7B%7D,'cvml','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
> <javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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
> <javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@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.

Reply via email to