On Dec 29, 2010, at 5:14 PM, Eric Lavigne wrote:

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

I've tried the same, but not in core.clj, but in another file named hello.clj:

(ns kenji.hello )
        
(defn hi [name]
        (println "HI " name))

Then I go to the REPL and I try:

[...@slicingupeyeballs:~/kenji]$ lein repl                        (12-29 23:26)
REPL started; server listening on localhost:21669.
kenji.core=> (:require 'kenji.hello)
nil
kenji.core=> (hi "nick")
java.lang.Exception: Unable to resolve symbol: hi in this context 
(NO_SOURCE_FILE:2)

[...@slicingupeyeballs:~/kenji]$ ls -l src/kenji                  (12-29 23:31)
total 24
-rw-r--r--@ 1 ngw  staff   244 Dec 29 16:24 core.clj
-rw-r--r--@ 1 ngw  staff  5756 Dec 29 23:26 hello.clj

Stuff in core.clj works normally, no problem at all.

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

Reply via email to