On Dec 22, 8:55 am, "Mark Volkmann" <r.mark.volkm...@gmail.com> wrote:
> On Sun, Dec 21, 2008 at 3:44 PM, Stephen C. Gilardi <squee...@mac.com> wrote:
>
>
>
>
>
> > On Dec 21, 2008, at 4:35 PM, Mark Volkmann wrote:
>
> > Why do I get an IncompatibleClassChangeError below?  I'm using revision
> > 1180.
>
> > (def my-map {:a 1 :b 2})
> > (namespace my-map)
> > java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0)
>
> > I got a more informative message, with the difference perhaps being running
> > Java 6 instead of Java 5:
> > user=> (namespace my-map)
> > java.lang.IncompatibleClassChangeError: Class
> > clojure.lang.PersistentArrayMap does not implement the requested interface
> > clojure.lang.Named (repl-1:3)
> > In the call to (namespace my-map), my-map is a symbol and the rule for
> > evaluating symbols (as function arguments and elsewhere) is that they are
> > replaced by the value of the var they name.
> > Your call got evaluated as (namespace {:a 1 :b 2}) which doesn't work.
> > What were you intending to determine in your call?
> > --Steve
>
> I thought that every symbol and keyword was in some namespace,
> defaulting to the current namespace when the symbol or keyword is
> defined.

Symbols and keywords aren't 'in' namespaces. They are just names and
that might have namespace components.

> Since the default namespace in the REPL is user, that's what
> I expected. I get the same error though with any symbol that I def.
> For example,
>
> (def n 1)
> (namespace n)

You don't def symbols, you def vars. (def n 1) creates a var named by
the symbol n, with a value of 1.

When you say n in an expression context you are asking for the value
of the var named by n, i.e. 1.

Vars and Symbols are different things. If you have some experience
with CL - this is an area where Clojure differs a lot.

Rich


--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to