Namespaces in waiting

191 views
Skip to first unread message

Dave Tenny

unread,
Jan 1, 2014, 3:26:34 PM1/1/14
to clo...@googlegroups.com
When I use 'lein repl' in some project context and get to the REPL prompt, there's an available but as yet not ... present ... namespace, i.e. (all-ns) won't list the namespace(s) created in the lein project directory tree.

Is there some API I can use to see a list these available but not active namespaces?

I'm guessing that looking at what's on the class path doesn't necessarily tell me what namespaces might be USE-able via (use 'x).




Stephen C. Gilardi

unread,
Jan 6, 2014, 1:45:47 PM1/6/14
to clo...@googlegroups.com

On Jan 1, 2014, at 3:26 PM, Dave Tenny <dave....@gmail.com> wrote:

> When I use 'lein repl' in some project context and get to the REPL prompt, there's an available but as yet not ... present ... namespace, i.e. (all-ns) won't list the namespace(s) created in the lein project directory tree.
>
> Is there some API I can use to see a list these available but not active namespaces?

I’m not aware of one.

> I'm guessing that looking at what's on the class path doesn't necessarily tell me what namespaces might be USE-able via (use 'x).

Walking the classpath including the contents of jar files would be a way to construct such a list of USE-able (or REQUIRE-able) namespaces. It would involve traversing the directory structure under each entry in the classpath and reading at least the first ns form in each candidate file (or jar entry).

—Steve

Alex Ott

unread,
Jan 7, 2014, 9:02:28 AM1/7/14
to clo...@googlegroups.com
You can use find-namespaces from http://clojure.github.io/tools.namespace/#clojure.tools.namespace.find to + clojure.java.classpath to get a list of all namespaces in current classpath...



--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
With best wishes,                    Alex Ott
http://alexott.net/
Twitter: alexott_en (English), alexott (Russian)
Skype: alex.ott

Dave Tenny

unread,
Jan 7, 2014, 7:15:57 PM1/7/14
to clo...@googlegroups.com
Thanks for the pointer.  This appears to work solely off the clojure source and may be very useful.  It raises all kinds of non-namespace-related questions for me though that I'll ask in another topic.


You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/mu25hM3Cw4w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.

Dave Tenny

unread,
Jan 7, 2014, 7:31:46 PM1/7/14
to clo...@googlegroups.com
I just stumbled across this, which looks very much like it may be what I wanted:  clojure.core/loaded-libs


E.g.

$ lein repl
user=> (loaded-libs)
bultitude.core
cemerick.pomegranate
cemerick.pomegranate.aether
classlojure.core
clj-stacktrace.core
clj-stacktrace.repl
clj-stacktrace.utils
clojure.core
clojure.core.protocols
clojure.instant
...
clojure.zip
complete.core
dynapath.defaults
dynapath.dynamic-classpath
dynapath.util
flatland.useful.fn
flatland.useful.seq
flatland.useful.utils
jdt.core
jdt.java
jdt.shell
leiningen.core.classpath
leiningen.core.eval
leiningen.core.main
leiningen.core.project
leiningen.core.ssl
leiningen.core.user
leiningen.core.utils
leiningen.repl
leiningen.trampoline
me.raynes.conch
me.raynes.conch.low-level
net.cgrand.parsley
net.cgrand.parsley.fold
net.cgrand.parsley.grammar
net.cgrand.parsley.lrplus
net.cgrand.parsley.stack
net.cgrand.parsley.tree
...

and so on
Reply all
Reply to author
Forward
0 new messages