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



On Tue, Aug 13, 2013 at 7: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?)
>
> ** 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.
>
>
>


-- 
http://elhumidor.blogspot.com/

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