On Dec 11, 2008, at 3:23 PM, Kevin Downey wrote:
> your problem is '
> ' makes xml/parse a symbol and stops evaling it to a function
> symbols are callable like keywords so if you have a hash with symbols
> as keys you can
> ('a {'a 1 'b 2}) -> 1
>
> so ('xml/parse "/Users/me/correct/path/to/my.xml") is trying to lookup
> 'xml/parse in "/Users/me/correct/path/to/my.xml" doesn't find it, and
> returns nil
OK, that is basically what I thought. But why doesn't it work? I do
seem to be loading the xml.clj correctly (?) because I see:
user=> #'clojure.xml/emit
but if I use:
(def x (xml/parse "/Users/me/correct/path/to/my.xml"))
I get:
user=> java.lang.Exception: No such namespace: xml
clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:94: No such
namespace: xml
at clojure.lang.Compiler.analyze(Compiler.java:3713)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:2634)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3860)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.access$200(Compiler.java:37)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:343)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3858)
at clojure.lang.Compiler.analyze(Compiler.java:3698)
at clojure.lang.Compiler.analyze(Compiler.java:3671)
at clojure.lang.Compiler.eval(Compiler.java:3895)
at clojure.lang.Repl.main(Repl.java:75)
Caused by: java.lang.Exception: No such namespace: xml
at clojure.lang.Compiler.resolveIn(Compiler.java:3998)
at clojure.lang.Compiler.resolve(Compiler.java:3972)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:3955)
at clojure.lang.Compiler.analyze(Compiler.java:3686)
... 12 more
>
>
>
> On Thu, Dec 11, 2008 at 12:01 PM, Robert Koberg <[email protected]>
> wrote:
>>
>> Hi, (very new to clojure, emacs and lispish things)
>>
>> I am using the latest downloadable clojure (rather than SVN, which I
>> do have and see it is a bit different) in Aquamacs. I have installed
>> the clojure mode and am using it with inferior-lisp to see output.
>>
>> When looking at the source for the clojure/xml/xml.clj, I see the
>> example at the bottom which I modified to get to work (note the
>> apostrophe before xml/parse):
>>
>> (load-file "/Users/me/Downloads/clojure/src/clj/clojure/xml/xml.clj")
>> (def x ('xml/parse "/Users/me/correct/path/to/my.xml"))
>>
>> ; also tried URIs with file:///, file:// and file:/
>>
>> Am I doing something wrong (my actual path to the xml is truly
>> correct)? When I don't use the apostrophe I get an exception saying
>> the namespace xml cannot be found.
>>
>> But, since it seems to parse my xml, I get nil when trying to look at
>> what it is parsed to:
>>
>> user=> #'clojure.xml/emit
>> user=> #'user/x
>> user=> x ;also tried user/x, 'user/x, #'user/x...
>> nil
>>
>> I am sure this is an error between keyboard and chair, but what?
>>
>> thanks,
>> -Rob
>>
>>>
>>
>
>
>
> --
> And what is good, Phaedrus,
> And what is not good—
> Need we ask anyone to tell us these things?
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---