Don't forget about the third piece of the puzzle, #() (and fn). Whenever I need to create a function using ->, I just do #(-> % ...). It's about as much typing as (comp ...).
Personally, I can go either way—I just kind of wish that there was a consistent practice for the placement of the most important argument, whether it's first or last, in both core and contrib. On Oct 16, 7:22 pm, Sean Devlin <francoisdev...@gmail.com> wrote: > I have an idea in my head, and I can't quite put all the details > together. The intent with of this posting is to start a healthy > debate of the merits of -> vs. comp. I know people on this list will > think of something. > > After designing my own Clojure libraries for a while, I've come to a > conclusion in the -> vs. comp debate. I think comp & partial is a > better choice than ->, because they return a closure. I believe > working with closures have the following advantages > > * It "just works" with higher order functions, like map or filter. > * comp, like any other function, can be swapped out. As long as the > result is a closure, the rest of the code will "just work". This makes > swapping out a monad more straightforward. > * comp & partial can be applied to a list, -> cannot. > > Given these reasons, I'd like to make a proposal. Contrib should be > centered around closures, not ->. > > In order to generate closures, every function should take parameters > first, and data at the end, so that they work well with partial. When > possible, higher order functions should be given preference over > macros. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---