I have a macro for creating a hash-map. I should send a name of a mashup and contents that get from calling a function (in this example it is a function xx).
(defmacro data-for-mashup [mashup-name func]
`(map {} {:title :content} {~mashup-name (~@func)}))
The macro should get any mashup name and any function, that's why I wanted it to be a macro.
Wnen I call it I want the result to look like this
{:title "Events Mashup"
:content [{ :event-name "event name 1"
:performer "performer 1"
:date "date 1"
:start-time "start time 1"
:end-time "end time 1"}
{:event-name "event name 2"
:performer "performer 2"
:date "date 2"
:start-time "start time 2"
:end-time "end time 2"}]}
The value of content tag is in fact a vector of maps.
A call to a macro should get the result like this
(data-for-mashup "events" (xx))
in REPL I get this as a result
(["events" #<datamodel$xx mashup_dsl.datamodel$xx@530f0fbd>])
macroexpand-1 results in this
(macroexpand-1 `(data-for-mashup "events" (xx)))
(clojure.core/map {} {:title :content} {"events" mashup-dsl.datamodel/xx})
(The xx is a function in my namespace.)
When in fact I want it to expand to this
(map {} {:title :content} {"events" (xx)})
What am I doing wrong?