Clojure Namespaces

I want to break a large clojure - script into smaller ones. And it looks like this.

One:

(ns one
  (:use [two :only (show)]))

(def status "WORKING")

Two:

(ns two
  (:use [one :only (status)]))

(defn show [] (println status))

Result: Exception .

PS I understand that there is some kind of recursive construction of the namespace. I only know a sloppy half-solution, for example, a definition without a body before referring to namespaces? Any suggestions?

+3
source share
2 answers

+1 ponzao. : , / API. "" , , .

, .

/space.clj:

(ns name.space)

(declare status)

(load "space_one")
(load "space_two")

/space_one.clj:

(in-ns 'name.space)
(defn show [] (println status))

/space_two.clj:

(in-ns 'name.space)
(def status "WORKING")
+11

, , , ? , ?

+6

All Articles