To be honest I prefer the first although I get your point about the over 
simplification.

If I were going anywhere with this it would be to generalise it into a 
provided processor, something like:

(->> :processor map
  things
  wrangle
  ...
)

but I am not sure the cognitive load of the extra syntax buys us much.

On Thursday, 6 February 2014 14:40:50 UTC, Korny 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.

Reply via email to