Created
August 8, 2017 09:36
-
-
Save nakkaya/7050d5daf2c7034a25bb079658d8b2dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn + | |
"Returns the sum of nums. (+) returns 0. Does not auto-promote | |
longs, will throw on overflow. See also: +'" | |
{:inline (nary-inline 'add 'unchecked_add) | |
:inline-arities >1? | |
:added "1.2"} | |
([] 0) | |
([x] (cast Number x)) | |
([x y] (. clojure.lang.Numbers (add x y))) | |
([x y & more] | |
(reduce1 + (+ x y) more))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn + | |
([] 0) | |
([x] x) | |
([h v] | |
"__result = h.cast<number>()->add(v);") | |
([x y & more] | |
(reduce + (+ x y) more))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment