+1, this is mostly what we resort to. (defn some-async-func [param-a param-b & [out-chan]] (let [ch (or out-chan (chan)] ... )
2014-11-11 8:53 GMT+00:00 Daniel Kersten <dkers...@gmail.com>: > You could do both: > > Make the channel optional. If it's provided, use that and return it. If > it's not provided, create a new one and use and return that. > > This way the caller gets to decide which they wish to use based on who the > owner of the channel should be or if the channel should be reused elsewhere. > > For example, for a once-off call, creating s new channel may make more > sense but if the function is called frequently it might make more sense to > reuse one channel, especially if this channel is used with other plumbing > like pub/sub or mult which you would otherwise need to set up every time. > > > On Mon, 10 Nov 2014 17:42 Mike Haney <txmikes...@gmail.com> wrote: > >> Eric Normand has an interesting article on this here: >> http://www.lispcast.com/core-async-code-style >> >> -- >> 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. >> > -- > 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. > -- László Török Checkout justonemorepoint.com - Know your true value -- 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.