On Fri, Oct 16, 2009 at 11:55 PM, samppi <rbysam...@gmail.com> wrote:
> 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. While we're at it, let's not forget the fourth piece of the puzzle: swap!, alter, send, and friends, which work best if functions put the data first and parameters after. If the parameters come first, all of them need to be wrapped: instead of (send agent foo param1 param2), say, you need (send agent #(foo param1 param2 %)). Yuck! (Irony: -> is also like swap!, alter, and their friends in this regard.) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---