On Fri, Dec 31, 2010 at 11:12 AM, xlarsx <xla...@gmail.com> wrote:
> user=> (binding [x 2 y 3] (+ x y))
> IllegalStateException Can't dynamically bind non-dynamic var: user/x
> clojure.lang.Var.pushThreadBindings (Var.java:339)
>
> The origin of this code is: http://clojure.org/vars

The docs refer to Clojure 1.2 but the error you're seeing indicates
you're running Clojure 1.3 (alpha/snapshot), yes?

In Clojure 1.3, variables must be declared dynamic in order to change
their bound value:

(def ^:dynamic x 1)
(def ^:dynamic y 1)
(binding [x 2 y 3] (+ x y))
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

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