A transducer for clojure.core.flatten

Skip to first unread message

Vincent Cantin

Feb 18, 2018, 2:29:46 PM2/18/18
to Clojure Dev

I would like to contribute to the language (I signed the contributor agreement already).

I noticed that the flatten function does not provide a transducer, I am proposing to implement one. But before I spend for effort on a PR, I would like to know if anyone is already working on that and how likely it is to be accepted.

Regards, Vincent.

Alex Miller

Feb 18, 2018, 3:58:16 PM2/18/18
to cloju...@googlegroups.com
Hi Vincent,

Generally cat and mapcat transducers cover most cases. I think a flatten transducer is pretty low priority.

> --
> You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
> To post to this group, send email to cloju...@googlegroups.com.
> Visit this group at https://groups.google.com/group/clojure-dev.
> For more options, visit https://groups.google.com/d/optout.

Tom Hicks

Feb 19, 2018, 11:23:15 AM2/19/18
to Clojure Dev
Hi Vincent,

You might consider contributing your additional transducers to Christophe's project: https://github.com/cgrand/xforms

Vincent Cantin

Feb 19, 2018, 2:01:21 PM2/19/18
to Clojure Dev
Hi Alex and Tom,

@Alex: cat and mapcat do not cover the case of arbitrarily deep tree structures, the user still has to build his own solution for that, and when they do they often end up using a mix of transducers and sequences which is not the best for performances.

@Tom: that's a good idea. I finally decided to implement a transducer version of `tree-seq` instead of `flatten` and I submitted it to his project already: https://github.com/cgrand/xforms/issues/20
Reply all
Reply to author
0 new messages