Hacker News new | ask | show | jobs
by cbp 4566 days 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.
1 comments

You can however use macros to generate the fixed argument count versions; I don't know if Scala is able to do that.
Macros are available but still experimental. They're already used in stable branches in a number of projects though, including the Play Framework.
It can, though the functionality is relatively recent.