My two cents: The way I see it, the use of #( ... % ...) is analogous to the usage of the word "it" in English: only use it when it is obvious beyond a shadow of a doubt what "it" means.
Think about how clunky English would be without the word "it". On Fri, Aug 16, 2013 at 4:32 PM, Timothy Baldridge <tbaldri...@gmail.com>wrote: > I'm just going to throw this out there, but I almost always consider using > #() instead of (fn []) to be bad practice. Like all syntactic sugar, it has > its place, but I reach for fn more often then not, because it allows me to > name the arguments and track in my mind the data with which I am working. % > means nothing to me, (fn [person]) at least gives me, as the reader of your > code, some context to go on when trying to parse what you've written. > > So I see it as a few less characters, at the expense of harder to > understand code. > > Timothy > > > On Fri, Aug 16, 2013 at 1:49 PM, Gregg Reynolds <d...@mobileink.com> wrote: > >> On Tue, Aug 13, 2013 at 1:50 PM, John D. Hume <duelin.mark...@gmail.com> >> wrote: >> > Though in some cases the performance impact could be significant, my >> concern >> > is readability. My understanding of the concept of partial function >> > application is that it's about supplying some but not all of the >> arguments. >> > So when I see `partial` in code, I expect more arguments to be supplied >> > later, which is confusing when that's not the case. (Obviously context >> can >> > make it easy to see that there will be no more arguments, but often that >> > context is not present.) >> > >> >> +1. Using partial to convert a unary func into a nullary func when >> #() is available strikes me as malpractice. Suppose you were to come >> across something like this in legacy code: >> >> >> (do-work (partial say-hello "bob")) >> >> For me, the natural inference would be that say-hello must want at >> least one more arg (otherwise why partial?), so do-work must be >> feeding some arg to the result of (partial say-hello "bob"), like >> adding "Don't worry, we're not watching you", in case the NSA owns >> do-work. Execution efficiency aside, downstream programmer confusion >> due to implied semantics also has a cost. >> >> -Gregg >> >> -- >> -- >> 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. >> > > > > -- > “One of the main causes of the fall of the Roman Empire was that–lacking > zero–they had no way to indicate successful termination of their C > programs.” > (Robert Firth) > > -- > -- > 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.