by Matt Revelle
Earlier today on #clojure, there was a brief discussion on how larger (including infinite!) arity functions are implemented in Clojure. An example similar to what started the discussion: (apply + (range 100)) The interesting bit happens in RestFn and how the compiler lays out the bytecode. The implementation of + is: (defn + "Returns the sum of nums. (+) returns 0." {:inline (fn [x y] `(. clojure.lang.Numbers (add ~x ~y))) :inline-arities #{2}} ([] 0) ([x] (cast Number x)) ([x y] (. clojure...
June, 20 2009 • 0 Comments • 0 Faves