In clojure, a value is usually associated in one of two ways:
locals without a namespace classifier (usually in a let statement or fn / loop args)
This applies to values โโthat are not specified outside the scope of the block (unless they are provided as an argument to the function inside the block or in the return value of the block).
vars with a namespace scope, usually using def (or a secondary macro like defn )
This is for values โโthat should be available in the namespace area, which will be available wherever you can access the namespace.
The error (attempting to invoke an unbound fn) is caused by using declare to create var and then invoking without providing a true definition:
user> (declare foo)
In this code, var exists ( declare created it), but no value has been assigned. So you need the last type of binding, var binding:
user> (defn foo [] "OK") #'user/foo user> (foo) "OK" user>
Somewhere, part of the code or the code of the library you are using declared var, which should be bound to the value being called, but not be correctly initialized. Does the library have an init function that you did not call? Maybe there is a namespace that needs to be required before the definition is visible?
source share