Hi Steve, Thanks for the explanation, and for the updated version of macro?
Cheers, Stuart > On Nov 25, 2008, at 7:28 PM, Stuart Halloway wrote: > >> (1) Did macro? ever work? If it did, I would like to go back and >> understand what change was made to Clojure and why. > > Yes it did work. I believe the change described here: > > http://groups.google.com/group/clojure/msg/65b0dd5f0dfeee88 > > would have broken it and I suspect that's when it broke. > > I think in your patched version, the check for "fn?" will always be > false in current Clojure where fn? was recently changed to return true > only for functions (ultimately) created by fn. If we substitute the > new ifn? which has fn?'s old meaning, it will always return true > because the argument is a symbol and all symbols return true for ifn?. > > I've updated the definition to this: > > (defn macro? > "Returns true if x names a macro" > [x] > (and (symbol? x) > (boolean > (:macro (meta (resolve x)))))) > > macro? is now a function instead of a macro which makes it more > composable. > > Here's an example. Name all the macros in clojure.core: > > (filter macro? (map first (ns-publics 'clojure.core))) > > (time doseq for cond fn dosync with-open sync let dotimes defmethod > lazy-cat defstruct with-in-str loop with-out-str when-not refer- > clojure .. doto proxy-super assert memfn when-first definline defn- > comment ns with-precision or defn with-local-vars when-let amap -> > while defmacro if-let and lazy-cons declare locking delay defmulti > proxy defonce when areduce binding doc) > > --Steve > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
