On Wed, Sep 3, 2014 at 11:31 AM, cig <clifford.goldb...@gmail.com> wrote: > Thanks Timothy, that makes sense. > > A follow on question if you don't mind. > > I would like to 'take' n items off of a channel, but wait until n items are > available rather than eagerly returning the way take does. Do you have any > ideas on how > I could achieve this?
Hi, I think by design core.async does not provide any information about the channel, so there is no way to know how many items are available. However I implemented something similar using the following. Where n is the number of items you want. (repeatedly n #(<!! feed-chan)) If the channel is closed with less than n items in it the remaining items will be nil. Note: I just started dabbling with core.async so there is probably a better way to do this. -- - Yohan Pereira -- 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.