While writing my first clojure application, I guess I am facing beginner
issue with namespacing :

I defined a function in a  dedicated namespace
i.e
(ns myapp.other)
(defn foo [x] (+x 42))

and try to use the foo from a different namespace


It seems
*(require 'myapp.other) ;*; is not enough to call the foo function directly


Of course,  calling it with explicit namespace preifx after the
*(require *'myapp.other)
works as expected :

*(require 'myapp.other)*

*(myapp.other/foo 10);;=>52*

I found that using *refer *you may avoid the verbose namespacing prefix

*(require 'myapp.other)*

*(refer 'myapp.other)*

*(foo 20);;=>62*

Now my newbie question :
Is there a simpler way to avoid the redundant 2 lines

*(require 'myapp.other)*
*(refer 'myapp.other)*

As simple as it seems, I was not able to find a proper documentationi which
did not describe the full details of clojure namespacing...

Thanks for your understanding
(and merry xmas)

Eric

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to