1

How do I list the functions/vars of a ClojureScripts namespace ?

This is a question that has an equivalent for Clojure, but the solutions mentioned did not work for me.

3 Answers 3

2

clojure.repl/dir works for me with latest ClojureScript (1.7.228)

Sign up to request clarification or add additional context in comments.

Comments

2

ns-interns seems to do what you need. If you need the vars/fns of the current namespace, you can use *ns* in conjunction with it.

Usage:

(keys (ns-interns 'my-ns)) ;; All defined variables/functions of an arbitrary evaluated namespace

(keys (ns-interns *ns*)) ;; All defined variables/functions of the current namespace

Note that value of ns differs in run time and compile time and using CIDER/REPL also affects which ns is currently set. The latter works in my lein repl but not in my CIDER repl for example. This answer has a possible solution to that issue.

1 Comment

alternatively, (keys (ns-publics 'my-ns)) , will list just the public mappings, which is a little easier to manage on some of the bigger modules.
0

Fow now I am doing :

(.keys js/Object my.ns)

As it looks like a namespace is an js object.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.