Skip to content

Instantly share code, notes, and snippets.

@noprompt
Created September 2, 2014 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noprompt/acf7327ba3b874d25e59 to your computer and use it in GitHub Desktop.
Save noprompt/acf7327ba3b874d25e59 to your computer and use it in GitHub Desktop.
clojure.core/macroexpand-1 vs cljs.analyzer/macroexpand-1
(ns user
(:require [cljs.analyzer :as analyzer]))
(let [ns-env (assoc-in (analyzer/empty-env) [:ns [:name]] 'cljs.user)]
(analyzer/macroexpand-1 ns-env `(defn ~'foo [~'x] ~'x)))
;; (clojure.core/defn foo [x] x)
(macroexpand-1 `(defn ~'foo [~'x] ~'x))
;; (def foo (clojure.core/fn ([x] x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment