   {:body (.getMessage e) :status 400})
 
 (defn compose
+  "Expects spec to be a formal specification with ns form in the beginning.
+  If the namespace exists, erases it. Then evaluates the spec and returns
+  the namespace used in the specification."
   [spec]
   (let [ns (spec/get-ns-name spec)]
     (try

      (catch Exception e (bad-request e)))))

(defn export
  [spec]
    {:body {:filename (if-let [ns (spec/get-ns-name spec)]
                        (str (peek (str/split ns #"\.")) ".clj")

            :contents spec}})

(defn execute-with-ns
  "Evaluates command, which should be a valid Clojure form with execute or
  execute-init, in a namepace ns. Returns the result of the evaluation as
  string."
  [ns command]
  (try
    {:body (str (binding [*ns* (find-ns (symbol ns))] (load-string command)))}
