Question

I'm trying to write a helloworld with clojure. I'm using leinengen with emacs and swank-clojure.

Here's what my src/hello.clj contains:

(ns hello)

(defn hello []  
(println "Hello World"))

When I clojure-jack-in and C-c C-c over the function, I get:

No such namespace: hello                                                   
[Thrown class java.lang.Exception]  

What am I doing wrong?

Was it helpful?

Solution

With C-c C-c, you're asking the backend to compile the function at point within the "hello" namespace, but that namespace doesn't yet exists -- you haven't executed the (ns hello) line yet. So try C-c C-k instead, which will compile the entire file. Thereafter, C-c C-c will allow you to re-compile the function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top