10

I have a clj file using a certain namespace and I wish to define something belonging to another namespace, so I do :

(def  other.namespace/name-of-something "value")

: but when I do this I get the result :

java.lang.Exception: Can't refer to qualified var that doesn't exist

Does anyone know why?

1 Answer 1

12

First, you'll need to ensure that the namespace exists via a call to create-ns:

(create-ns 'other.namespace)

Then, you can use the intern function to add definitions to that namespace:

(intern 'other.namespace 'name-of-something "value")

You can confirm this is present with a call to (ns-interns 'other.namespace).

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

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.