Stan Kurilin
Stan Kurilin

Reputation: 15812

Applying macros in other namespace

I have file with dsl-like stuff data. There I want to declore some s-expression based information. And I have some runner that process such files.

runner.clj

 (require '[data :as d])
 ;processing

data.clj

 (ns  data)
 (defmacro data [s] (println (str s)))

 ;dsl like stuff goes here
 (data "foo")

How can I remove non dsl from data file like defmacro?

Also any links to source code with similar solutions are welcome.

Upvotes: 1

Views: 53

Answers (1)

kotarak
kotarak

Reputation: 17299

; dsl.clj
(ns dsl)
(defmacro data ...)

; data.clj
(ns data
  (:require dsl))

(dsl/data ...)

Or with use:

; data.clj
(ns data
  (:use [dsl :only (data)]))

(data ...)

Upvotes: 2

Related Questions