On Tue, Aug 13, 2013 at 8:47 AM, Jay Fields <j...@jayfields.com> wrote: > Say you have a simple function: (defn do-work [f] (f)) > > When you want to call do-work you need a function, let's pretend we > want to use this function: (defn say-hello [n] (println "hello" n)) > > Which of the following solutions do you prefer? > > (do-work (partial say-hello "bob")) > (do-work #(say-hello "bob")) > > I'd been using partial (which I font-lock**), but a teammate recently > pointed out that partial's documentation explicitly calls out the fact > that the number of args to partial should be less than the number of > args to f. In practice it's been working 'fine', but I can't help but > wonder if I'm sacrificing something I'm not aware of (performance?)
It depends. I endeavor to use `partial` whenever what I'm doing is fixing leading arguments. I think it reads better. Whenever I have to fall back to to the reader macro it is always because the args were ordered poorly for my particular use. I usually get frustrated at the library author at this point, and then quickly realize what an idiot I'm being and move on. I haven't had any situations yet that required deep optimization and I'm a firm believer in premature optimization being the root of all evil so for the entirety of my career in clojure I've only ever optimized for readability. I'll get to that next level soon enough, I'm sure. -- In Christ, Timmy V. http://blog.twonegatives.com/ http://five.sentenc.es/ -- Spend less time on mail -- -- 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.