Hi, 

Partial calls apply, so it's not as performant as #(..). That can make 
quite the difference depending on where it's used. All instances of partial 
were removed recently in carmine/nippy and that resulted in quite a 
performance improvement.

On Tuesday, August 13, 2013 2:47:01 PM UTC+2, Jay Fields 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?) 
>
> ** with a font-lock, using partial *displays* the same number of chars 
> as the reader macro solution, and I find it more readable when 
> everything is in the parenthesis. - 
> http://blog.jayfields.com/2013/05/emacs-lisp-font-lock-for-clojures.html 
>

-- 
-- 
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