8 ms·
If I understand that scala code correctly it's just enumerating a multiple arity function manually. It's not that uncommon to see that in clojure for performanc
by cbp 13y ago
If I understand that scala code correctly it's just enumerating a multiple arity function manually. It's not that uncommon to see that in clojure for performance reaasons, clojure.core has plenty of examples as does the java-written compiler. It's a lot faster to enumerate the common arities than to use apply like:
(defn f [& args]
(apply g args))
And it usually just takes a couple of strokes in any decent text editor anyway.
- jadyoyster 13y agoYou can however use macros to generate the fixed argument count versions; I don't know if Scala is able to do that.