On 11 February 2011 02:15, Ken Wesson <kwess...@gmail.com> wrote:
> (defmacro macrolet* [shadowlist fnspecs & body]
>  (let [locals (keys &env)
>        gensyms (for [_ locals] (gensym))
>        qlocals (map quo (for [_ locals] (gensym)))
>        ...

This macro is huge!!!

You might want something more like:

  (require '[clojure.walk :as walk])

  (defn fnmap [fnspecs]
    (zipmap
     (map first fnspecs)
     (for [f fnspecs]
       (cons 'fn (rest f)))))

  (defn expand-macrolet [macro-fns form]
    (if (seq? form)
      (let [[name & args] form]
        (if-let [m (macro-fns name)]
          `(eval (~m ~@args))
          form))
      form))

  (defmacro macrolet [fnspecs & body]
    `(do ~@(walk/postwalk
            (partial expand-macrolet (fnmap fnspecs))
            body)))

I'm not sure that does everything you want, but it's probably not far off.

- James

-- 
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

Reply via email to