I found that Rich wrote a simple tracing facility:
http://groups.google.com/group/clojure/browse_frm/thread/fd315d9dfdb8c32c/7479682cdf3a1b97

What I had in mind is to literally turn on and off parts of code. This way  
I can play with design by contract:

(def *section-tags* {:require true})

(defmacro section [tag & body]
   (if (*section-tags* tag)
     `(do [EMAIL PROTECTED])))

(defn mysqrt [x]
   (section :require
     (if (< x 0)
       (throw (new Exception "mysqrt: x >= 0"))))
   (Math/sqrt x))

----

user=> (mysqrt 2)
1.4142135623730951

user=> (mysqrt -1)
java.lang.Exception: mysqrt: x >= 0

Frantisek
 

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

Reply via email to