Even though I've written only one toy web framework in Clojure[1], (I think) I know the difference.
Because there is documentation for use and ns, I'll add my own only :) I interpret "(use 'ns)" as "Use 'ns namespace within *current* namespace - from your example, 'user'. Usually for REPL. (ns ...) is a definition of namespace. You can define any namespace in any file, I guess (I didn't try that but it seems it's the right thing to me). I interpret "(ns ns1 (:use 'ns2)" as "Define ns1 namespace and from ns1 namespace use stuff in ns2 namespace. Usually for files. I bet ns is a macro and use 'use' - that's what I'll do. You should try macroexpand those things to learn how it works and think such a way. Once you have this ability, when you see something new and read doc or usage of it, you can imagine if it is function or macro, and (for macro) how underlying macroexpansion would look like, etc. [1]:https://github.com/defstruct/tbw On Wednesday, 30 November 2011 22:06:04 UTC+11, j1n3l0 wrote: > > Also in a REPL you can do the following: > > user> (use 'example.core) > nil > user> > > But in a source file you have to do: > > (ns stuff.core > (:use 'example.core)) > > I think I've seen the reason for this difference once before but can > someone more learned *please* explain :) > -- 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