Last active
May 16, 2018 14:25
-
-
Save moxaj/82d9ac9cc79ca17231afdd33c7b91274 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
(set! *warn-on-reflection* true) | |
(defn apply-fn1 [x f arg] | |
;; apply f | |
x) | |
(defmacro apply-fn2 [x f arg type] | |
(vary-meta (do | |
;; apply f | |
x) | |
assoc :tag type)) | |
(defn foo1 [x] | |
(-> x | |
(apply-fn1 nil nil) | |
(.length))) ;; Reflection warning! | |
(defn foo2 [x] | |
(-> x | |
(apply-fn2 nil nil String) | |
(.length))) ;; No reflection warning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment