Error formatting macro: pagetree: java.lang.NullPointerException

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add namespace "export" question/answer

...

  1. Why can't I require/use my project_name.foo namespace ?
    Because here, your namespace is loaded from the disk. For good interop with JVM features, Clojure does some "munging/unmunging" of names depending of them having to be "consumed" by the "clojure side" or the "jvm side" of the equation. So a "_" in a namespace "folder name/file name" has to correspond to a "-" in the namespace name. Check that your namespace on disk is in "project_name/foo.clj", while your namespace is declared as "project-name.foo" (e.g. in a (ns project-name.foo) directive).
  2. How can I make a namespace A that "exports" all the public symbols from namespaces B and C?

    You can't. "Public" symbols are not transitive. As an alternative, you can define a function in namespace A which calls refer for namespaces B and C, then call that function in any namespace where you want all those symbols to be available. Be aware that this makes it harder for people reading your source code to see where the symbols come from.

Syntax

  1. Why doesn't #(%) work?
    Because it expands to (fn x (x)). #() always expands to include parens around the expression you give it. You might try #(vector x) instead.

...