   {: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")

            [clojure.string :as str]))

(defn example-listing
  "Returns names of all possible examples."
  []
  {:body (map examples/example
              (examples/files-in-classpath examples/example-dir))})

(defn example-file
  "Returns the contents of an example specification by filename."
  [filename]
  {:body {:contents (slurp (examples/example-file filename))}})

