Hi all

I'm trying to build a vector data structure that can be printed using
the core prn function.

Here's my test case


(defn ea-xmi [dname & packages]
  [:xmi {:version "2.1"
         :nsuml "http://schema.omg.org/spec/UML/2.1";
         :nsxmi "http://schema.omg.org/spec/XMI/2.1";
         :customprofile "http://www.sparxsystems.com/profiles/
thecustomprofile/1.0"}
   (map #(eval %) packages)])

(defn ea-document [dname & packages]
  [:Documentation {:exporter "Enterprise Architect" :exporterVersion
"6.5"}]
  [:Model {:type "uml:Model" :name (str/join [dname
"_Model"]) :visibility "public"}])

And this is how I want to call it:- (this I dont want to change - it's
the dsl)

(def output
  (ea-xmi "Oil"
    (ea-document "Fundamental")))

What I get as the output is:-
[:xmi {:version 2.1, :nsuml http://schema.omg.org/spec/UML/2.1, :nsxmi
http://sc
hema.omg.org/spec/XMI/2.1, :customprofile http://www.sparxsystems.com/profiles/t
hecustomprofile/1.0} ([:Model {:type uml:Model, :name
Fundamental_Model, :visibi
lity public}])]


Whereas I would want:-

[:xmi {:version 2.1, :nsuml http://schema.omg.org/spec/UML/2.1, :nsxmi
http://schema.omg.org/spec/XMI/2.1, :customprofile
http://www.sparxsystems.com/profiles/thecustomprofile/1.0} [:Model
{:type uml:Model, :name Fundamental_Model, :visibility public}]]

The difference is minimal, just the additional () around the second
vector. Why is this and how do I remove it (at construction time). I'm
guessing it's how I call eval within map, but I've tried identity and
apply and still can't get it right. Any ideas?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to