On Tue, Sep 3, 2013 at 12:41 PM, Konrad Hinsen <
googlegro...@khinsen.fastmail.net> wrote:

>
> Not quite. It expands only terms that are evaluated, using a built-in
> table of special forms, and it allows local macro definitions (macrolet).
> But most importantly, it tracks local bindings


Local binding tracking is at best inconsistent. mexpand-all produces the
same incorrect result that Proteus's previous code-walker did:

user=> (require '[clojure.tools.macro :as m])
nil
user=> (defmacro aif [test then else]
  #_=>            (let [it (first (filter #(not (contains? &env %))
  #_=>                                    (cons 'it (map #(symbol (str
"it-" %)) (iterate inc 1)))))]
  #_=>              `(let [~it ~test] (if ~it ~then ~else))))
#'user/aif
user=> (m/mexpand-all '(aif (get {:x {:y 3}} :x) (aif (get it :y) [it it-1]
it) nil))
(let* [it (get {:x {:y 3}} :x)] (if it (let* [it (get it :y)] (if it [it
it-1] it)) nil))

The inner let* should be binding it-1.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to