Created
September 24, 2014 17:33
-
-
Save jafingerhut/f3f350d6bc2e3956b645 to your computer and use it in GitHub Desktop.
Revisions
-
jafingerhut created this gist
Sep 24, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ ;; TBD: What is going on here? ;; Why does (Math/abs (f2 -3)) cause a ;; reflection warning, but neither of the other variants does? user=> (clojure-version) "1.6.0" user=> (set! *warn-on-reflection* true) true user=> (defn ^{:tag 'long} f1 [x] (inc x)) #'user/f1 user=> (Math/abs (f1 -3)) 2 user=> (defn ^{:tag 'long} f2 [^long x] (inc x)) #'user/f2 user=> (Math/abs (f2 -3)) Reflection warning, NO_SOURCE_PATH:6:1 - call to static method abs on java.lang.Math can't be resolved (argument types: java.lang.Object). 2 user=> (defn ^{:tag 'long} f3 ^long [^long x] (inc x)) #'user/f3 user=> (Math/abs (f3 -3)) 2