Re: Benefits to partial functions.

2019-10-20 Thread Alex Engelberg
All functions returned by a given arity of partial or comp are of the same Java class under the hood, whereas defining an anonymous function always generates a new class, and I've heard that fewer classes can result in better performance from a JIT perspective. But I'm just speculating and haven't

Re: Benefits to partial functions.

2019-10-20 Thread John D. Hume
It's been a long time since I looked at this, but as of a few years ago, the biggest noticeable performance detriment of comp or partial was likely to come if you pass enough args to hit a "& args" overload, which requires creating a fresh object array at each call, when the underlying function bei

Benefits to partial functions.

2019-10-20 Thread david hoyt
Is there a performance benefit (or detriment) to creating partial functions? Other than the potential reduction of complexity, is there a difference between using partial & comp and defining new functions? -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Can't use my macro in fuction definition

2019-10-20 Thread ru
Thank you, Marc! I will try to use your example to develop more general "instance" function. Sincerely, Ru воскресенье, 20 октября 2019 г., 15:35:48 UTC+3 пользователь mlimotte написал: > > Hey Ru, > > I'd also add that `new` is a special form, not a function. It is > evaluated at compile-ti

Re: Can't use my macro in fuction definition

2019-10-20 Thread Marc Limotte
Hey Ru, I'd also add that `new` is a special form, not a function. It is evaluated at compile-time, which is why the macro doesn't work. You can also try macro-expansion to see what's going on: (defn itest [x] (macroexpand-1 '(instance x))) => #'user/itest (itest java.lang.String) => (new x)