Why can't I reference result of (defrecord Foo [bar]) in REPL after (load-file “foofile.clj”)?

You need to import Foo, since it's a java class.

Up vote 2 down vote favorite share g+ share fb share tw.

My file looks like this, more or less: (ns foofile) (defprotocol foo-protocol "foo(lish example)" (foo-method this "foo docs") (defrecord Foo biz) (def foo (Foo. "baz")) I start the REPL and type (load-file "foofile. Clj") and it prints #'foofile/foo Now I can reference foofile/foo and foofile/foo-protocol, but when I try foofile/Foo, I get java.lang.

Exception: No such var: foofile/Foo (NO_SOURCE_FILE:0) The same (or substantially similar) code works just dandy if I manually enter in into the REPL (specifically, I followed this blog post). What's going on here? What's different between doing this in the REPL and loading a file?

Clojure link|improve this question asked May 6 '11 at 1:00twneale795515 90% accept rate.

You need to import Foo, since it's a java class: (import 'foofile. Foo) The reason it works when you enter your code in a repl is that you're in the same namespace you declared Foo in when you're referring to Foo (probably the namespace user).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions