I did the same recently, you can already leverage transducer support in 
core.async while staying backward compatible with clojure 1.6. You loose 
some sugar and the transducer versions of most sequences functions but it's 
very usable still. 

you can see 2 examples here: 
https://github.com/mpenet/jet/blob/master/src/clj/qbits/jet/client/http.clj#L63-L84

one just decodes chunk from http responses as they are fed to a channel, 
the other takes every chunk from the response and reduces them into a 
single value before putting it into the channel. Not a killer use for sure, 
but it makes code a lot less convoluted.

On Monday, December 29, 2014 7:00:38 PM UTC+1, Francis Avila wrote:
>
> It will be inconvenient to use transducer functions without the transducer 
> support added in 1.7.0, but there's nothing magical about transducers that 
> requires Clojure 1.7.
>
> Core.async 0.1.346.0-17112a-alpha does not depend on clojure 1.7 (it only 
> depends on Clojure 1.6) and you don't need anything special to create a 
> transducing function. We use the transducer features of core.async with 
> Clojure 1.6 in production.
>
> All you need to do is provide the core async channel with a function that 
> has the transducer structure: a function accepting a transforming-function 
> (supplied by core.async) and returning a function with three arities for 
> initialization, finalization, and the reduction step.
>
> (fn [xf]
>   (fn
>     ([] (xf))
>     ([r] (xf r))
>     ([r v] (xf r v)))
>
> We use an as-transducer function as a convenience to make these:
>
> https://gist.github.com/favila/ecdd031e22426b93a78f
>
> On Monday, December 29, 2014 10:38:05 AM UTC-6, Udayakumar Rayala wrote:
>>
>> Hi,
>>
>> We are currently using clojure 1.6.0 and using async channels version 
>> "0.1.346.0-17112a-alpha". 
>> I see that the (chan) function accepts a transducers but transducers are 
>> not available in Clojure 1.6.0. 
>>
>> Is there any option other than upgrading to Clojure 1.7.0-alpha4? If not, 
>> how safe it is right now to use Clojure 1.7.0-alpha4 in production? We 
>> really want to use transducers as it makes our code readable.
>>
>> Thanks,
>> Uday.
>>
>

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