On 16.03.2009, at 11:35, Elena wrote:

> in this code:
>
> (defn main []
>       (check-services))
>
> (defn check-services []
>       1)
>
> if I call slime-eval-defun on "main" before calling it on "check-
> services", Clojure aborts with:
>
> java.lang.Exception: Unable to resolve symbol: check-services in this
> context (NO_SOURCE_FILE:3)
>   [Thrown class clojure.lang.Compiler$CompilerException]
>
> Is it expected?

Yes. Clojure checks that symbols are defined before they are used.  
You can put

(declare check-services)

before your definition of main to define the symbol and make it clear  
to the (human) reader that you indeed to give the real definition later.

Konrad.


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