Hi everybody,

I just got started with Clojure and I'm now trying to simultaneously
learn Lisp and Java. My progress is slow, but I'm having a lot of fun.
I hit a small roadblock though, because I can't figure out why calling
load-file from within a do is behaving the way it is. I'm probably
missing something obvious, but hopefully someone will be able to
explain it.

I created a small file foo.clj with the following contents:
(defn foo [] :bar)

Then from a REPL I try the following:
(do (load-file "foo.clj") (foo))

but this gives an error message:
java.lang.Exception: Unable to resolve symbol: foo in this context
(NO_SOURCE_FILE :1)

Strangely enough, the following does work:
(do (load-file "foo.clj") (ns-interns 'user))
This returns {foo #'user/foo} (as expected)

So, while it seems that the file gets loaded and the function gets
added to the namespace, calling it from within the do doesn't seem to
work. What's going on?

thanks,
Kees
--~--~---------~--~----~------------~-------~--~----~
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