I agree with Colin, the cognitive load is greater than benefits of such
approach. BTW you can use comp to chain consecutive map transformation
functions. (map (comp pacify wrangle) things)
JW


On Thu, Feb 6, 2014 at 3:40 PM, Korny Sietsma <ko...@sietsma.com> wrote:

> Hi folks,
>
> I seem to regularly find myself writing ->> threaded code that follows
> similar patterns:
>
> (->> things
>     (map wrangle)
>     (map pacify)
>     (filter effable)
>     (map #(aggravate % :bees :sharks))
>     (reduce mapinate {})
>
> i.e. all stages of the code actually operate on a collection rather than a
> single value - usually with a call to "map" at each stage.  This example is
> over simplified - often many of the calls to map are inline functions,
> which makes this even more verbose.
>
> I wonder if there would be value in (yet another) variant on '->' that
> assumes you are threading a collection and calling 'map' by default.  I'm
> not sure of the syntax that would work though.  Something like:
>
> ([]-> things
>         wrangle
>         pacify
>         [:filter effable]
>         (aggravate :bees :sharks)
>         [:reduce mapinate {}])
>
> I'm not sure about the syntax for non-map functions, I'm not even sure if
> this is worthwhile.  Thoughts?
>
> - Korny
>
> --
> Kornelis Sietsma  korny at my surname dot com http://korny.info
> .fnord { display: none !important; }
>
> --
> 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.

Reply via email to