A few other things that might help:

1) you can use (put! c val) from inside any function. Sometimes if you want
to fire and forget a send, that might be the best option

2) you can wrap the code inside the sub fns inside another go. This isn't
as slow as you might think

3) think about using core.async's higher order ops like map, filter<, mux,
pub, mix, etc.

Often I've found that by rethinking the problem a bit in therms of these
ideas, it's possible to simplify the go blocks a bit.

Timothy


On Tue, Dec 31, 2013 at 7:14 PM, Cedric Greevey <cgree...@gmail.com> wrote:

> It should work if it's inlined or a macro. It won't shrink foo's generated
> code size any if bar is a macro, but it will split up the source code into
> smaller pieces if that's all you're concerned about.
>
>
> On Tue, Dec 31, 2013 at 8:50 PM, Paul Butcher <p...@paulbutcher.com>wrote:
>
>> I recently discovered that parking calls only work if they're directly
>> contained within a go block. So this works fine:
>>
>> (defn foo [ch]
>>   (go
>>     (<! ch)))
>>
>>
>> But this:
>>
>> (defn bar [ch]
>>   (<! ch))
>>
>> (defn foo [ch]
>>   (go
>>     (bar ch)))
>>
>>
>> Results in Assert failed: <! used not in (go ...) block
>>
>> Is there any way around this? If I have a go block that's getting too big
>> and want to extract some portion of it into a separate function, what's the
>> best approach?
>>
>>  --
>> paul.butcher->msgCount++
>>
>> Silverstone, Brands Hatch, Donington Park...
>> Who says I have a one track mind?
>>
>> http://www.paulbutcher.com/
>> LinkedIn: http://www.linkedin.com/in/paulbutcher
>> Skype: paulrabutcher
>>
>>
>>
>>
>>  --
>> --
>> 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.
>>
>
>  --
> --
> 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.
>



-- 
“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.

Reply via email to