Created
July 6, 2014 00:16
-
-
Save anonymous/9c839217c56642250639 to your computer and use it in GitHub Desktop.
Sub-macro Issues
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
(defmacro unit [a b] `[(quote ~a) ~b]) | |
(defmacro collect [& z] `(let [~'a 3 ~'b 7] (eval (apply concat (list 'cond) [~@z])))) | |
;works fine... | |
;(macroexpand-all '(collect (unit (< 2 3) "Object A") (unit (> 2 3) "Object B"))) | |
;(let* [a 3 b 7] (clojure.core/eval (clojure.core/apply clojure.core/concat (clojure.core/list (quote clojure.core/cond)) [[(quote (< 2 3)) "Object A"] [(quote (> 2 3)) "Object B"]]))) | |
;has issues | |
;(macroexpand-all '(collect (unit (< a 3) "Object A") (unit (> b 3) "Object B"))) | |
;(let* [a 3 b 7] (clojure.core/eval (clojure.core/apply clojure.core/concat (clojure.core/list (quote clojure.core/cond)) [[(quote (< a 3)) "Object A"] [(quote (> b 3)) "Object B"]]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment