clojure.contrib is not supported in clojure versions 1.3+
The reason in this case is that in 1.3+, it is necessary to add ^:dynamic
or ^{:dynamic true} in the def form (i.e. to the metadata)
for the var to be dynamically changed with bindings.

Fixed clojure.contrib.profile:
https://gist.github.com/3257930

Jonathan

On Sat, Aug 4, 2012 at 1:22 PM, Adrian Mowat <adrian.mo...@gmail.com> wrote:
> Hi All
>
> I'm trying to run the clojure contrib profiler and I'm getting an error.
> Has anyone faced the same problem?
>
> user=> (use 'clojure.contrib.profile)
> nil
> user=> (defn my-function [x y]
>                 (let [sum (prof :addition (+ x y))
>                       product (prof :multiplication (* x y))]
>                   [sum product]))
> #'user/my-function
> user=> (profile (dotimes [i 10000] (my-function 3 4)))
> IllegalStateException Can't dynamically bind non-dynamic var:
> clojure.contrib.profile/*profile-data*
 clojure.lang.Var.pushThreadBindings
> (Var.java:353)
>
> user=> *enable-profiling*
> true
>
>
>
> my project.clj looks like this
>
> (defproject clam "0.1.0-SNAPSHOT"
>   :description "Data description language for parsing text streams"
>   :url "https://github.com/mowat27/clam";
>   :license {:name "MIT Licence"
>             :url "http://copyfree.org/licenses/mit/license.txt"}
>   :dependencies [[org.clojure/clojure "1.4.0"]
>                  [org.clojure/clojure-contrib "1.2.0"]
>                  [midje "1.4.0"]
>                  [com.stuartsierra/lazytest "1.2.3"]]
>   :repositories {"stuart" "http://stuartsierra.com/maven2"})
>
>
> Thanks very much
>
>
> Adrian
>
> --
> 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 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