-
-
Save amalloy/3738c7ddac879aa790b1 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
(eval | |
`(let [foo# 10] | |
(defmacro use-foo# [x#] | |
`(+ ~foo# ~x#)) | |
(macroexpand '(use-foo# 5)))) | |
;=> (clojure.core/+ 10 5) | |
(eval | |
`(let [foo# 10] | |
(defmacro use-foo# [x#] | |
`(+ ~foo# ~x#)) | |
(use-foo# 5))) | |
;=> Wrong number of args (1) passed to: user$eval3352$use-foo--3348--auto-- | |
(let [fname (gensym) | |
foo 10] | |
(eval | |
`(do | |
(defmacro ~fname [x#] | |
`(+ ~~foo ~x#)) | |
(~fname 5)))) | |
;=> 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment