On Mon, Oct 26, 2009 at 12:45 AM, Timothy Pratley
<timothyprat...@gmail.com>wrote:

>
> This sounds like a neat idea to me. Maybe the way to get the
> 'complexity' is to calculate it at definition, this macro doesn't work
> for obvious reasons:
> (defmacro defnc
>  [n & body]
>  `(let [f# (defn ~n ~...@body)]
>     (alter-meta! (var ~n) assoc :complexity (count-nodes ~body))
>     f#))
> But I think something similar could do the trick?


Try

(defmacro defnc
 [n & body]
 `(let [f# (defn ~n ~...@body)]
    (alter-meta! (var ~n) assoc :complexity (count-nodes (quote ~body)))
    f#))

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