hylang/hy — pull request #311 by sbp (2013-10-11 15:40:00+00:00)
Title: Compiler based macroexpand and macroexpand-1

This pull request is an alternative implementation of #310. That PR uses library functions and some messy `inspect` code. This PR uses the compiler instead. Choose whichever you prefer!

```clojure
=> (macroexpand '(-> (a b) (x y)))
(u'x' (u'a' u'b') u'y')
=> (macroexpand '(-> (a b) (-> (c d) (e f))))
(u'e' (u'c' (u'a' u'b') u'd') u'f')
=> (macroexpand-1 '(-> (a b) (-> (c d) (e f))))
(u'_>' (u'a' u'b') (u'c' u'd') (u'e' u'f'))
```

User defined macros work properly in the console:

```clojure
=> (defmacro square [x] `(* ~x ~x))
=> (macroexpand-1 '(square x))
(u'*' u'x' u'x')
```