• (read-ns-decl rdr)
Attempts to read a (ns ...) declaration from rdr, and returns the
unevaluated form. Returns nil if read fails or if a ns declaration
cannot be found. The ns declaration must be the first Clojure form
in the file, except for (comment ...) forms.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/find_namespaces.clj:52 top

(defn read-ns-decl
  "Attempts to read a (ns ...) declaration from rdr, and returns the
  unevaluated form.  Returns nil if read fails or if a ns declaration
  cannot be found.  The ns declaration must be the first Clojure form
  in the file, except for (comment ...)  forms."
  [^PushbackReader rdr]
  (try (let [form (read rdr)]
         (cond
           (ns-decl? form) form
           (comment? form) (recur rdr)
           :else nil))
       (catch Exception e nil)))
Vars in clojure.contrib.find-namespaces/read-ns-decl: cond defn let
Used in 0 other vars

Comments top

No comments for read-ns-decl. Log in to add a comment.