On Aug 15, 6:16 am, Richard  Rattigan <ratti...@gmail.com> wrote:
> I don't understand why this test would fail - can anyone explain why?
>
> (ns learn.clojure.test.core
>   (:use [clojure.test]))
> (deftest namespaces
>   (in-ns 'my.new.namespace)
>   (is (= "my.new.namespace" (str *ns*)))
>   (is (= `anything 'my.new.namespace/anything)))
>
> expected: (= (quote learn.clojure.test.core/anything) (quote
> my.new.namespace/anything))
>   actual: (not (= learn.clojure.test.core/anything my.new.namespace/
> anything))
>
> When I try this on the REPL, it seems to work as expected:
>
> user=> (in-ns 'my.new.namespace)
> #<Namespace my.new.namespace>
> my.new.namespace=> `anything
> my.new.namespace/anything

The syntax quoting happens at read time, before in-ns is executed. You
can do something similar at the repl:

user=> (do (in-ns 'tmp) `foo)
user/foo

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