On May 16, 2:05 pm, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > Every literal instance of `fn` or `#()` compiles to a new class definition. > This is only at compile time: once the code is running, each execution of > the `fn` expression merely creates an instance of that class. > > partial is implemented in terms of `fn`, so every usage of `partial` merely > creates an instance of a class that already exists. So using `partial` > instead of `fn` or `#()` saves a small amount of memory.
Note also that the tradeoff goes both ways - (partial f x) can't know how many more args to expect, so it has to create a vararg function, use apply, and all that jazz - a lambda can just accept exactly the right number of args and use them directly. So there's some runtime penalty for using partial. Of course, in both cases the difference is miniscule - use whatever makes your intent clearer. -- 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