Skip to content

Instantly share code, notes, and snippets.

@sritchie sritchie/test.clj
Created Apr 7, 2015

Embed
What would you like to do?
(defn cljs-env?
"Take the &env from a macro, and tell whether we are expanding into
cljs."
[env]
(boolean (:ns env)))
(defmacro if-cljs
"Return then if we are generating cljs code and else for Clojure code.
https://groups.google.com/d/msg/clojurescript/iBY5HaQda4A/w1lAQi9_AwsJ"
[then else]
(if (cljs-env? &env) then else))
(defmacro when-clj
[& forms]
(when-not (cljs-env? &env) `(do ~@forms)))
(defmacro when-cljs
[& forms]
(when (cljs-env? &env) `(do ~@forms)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.