Hi, Nicholas.

I would need to see more detail in order to know what is going wrong
in your case. I created a new project myself so that you can see an
example that does work.

First I typed this:

    lein new hello

That created a project in the hello directory. I changed in that
directory and edited the file src\hello\core.clj (backslashes because
I am working on Windows, but that isn't a big difference).

    cd hello
    write src\hello\core.clj

I edited that file to look like this (added an example function).

    (ns hello.core)

    (defn say-hello [name]
        (println "Hello, " name))

After saving that file, I started a REPL to test it out.

    lein repl
    (use 'hello.core)
    (say-hello "Nicholas")

And the REPL responded with:

    Hello, Nicholas
    nil

It printed out the statement, as I told it to, and showed the return
value of my function: nil.

Note the single-quote in (use 'hello.core) which is a little different
from how the same thing would look as part of the ns macro.

Let me know if you have any more questions about this.

On Wed, Dec 29, 2010 at 10:49 AM, Nicholas Wieland
<nicholas.wiel...@gmail.com> wrote:
> Hi *,
> I'm a bit ashamed but considering that I'm a newbie in Clojure and a total 
> newbie in Java there's apparently no end to this metanewbie status I'm 
> currently in :-)
> I'm trying to require a file and use it from the REPL, but every time I try 
> to call a function from this file Clojure is not able to resolve the symbol.
> What I did is creating a project using lein, and lein created a directory 
> structure that includes src/project_name, where I believe I'm supposed to put 
> my files.
> Now, other than the canonical core.clj I've created another file foo.clj. 
> There's still no interaction between the 2 files, but just as a matter of 
> testing what I'm writing I would like to be able to call the functions of 
> foo.clj from the REPL. The namespace is declared to be project_name.foo.
> I've tried to use both require and use inside lein repl, no matter what I do 
> it doesn't find the file (NO_SOURCE_FILE). If I understand the functioning 
> right I'm supposed to only use the namespace, so (:require project_name.foo) 
> should actually work and include the full namespace (that I translate 
> mentally with "file" :) inside the current one, that according to the repl is 
> project_name.core.
> Someone has a suggestion on where to look or how to fix ?
>
>  ngw
>
> --
> 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

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