   (try (slurp in)
        (catch Exception e
          (fail (str "Could not read from '" in "'.")))))
+
+(defn- strmap [f coll]
+  (apply str (map f coll)))
 
 (defn- usage [summary]
   (doseq [x [""


;; formatting

(defn- fmt-namelist [m]
  (let [f0 (fn [[dataref values]]
             (str "  " dataref "=" values "\n"))
        f1 (fn [[name nvseq]]
             (str "&" name "\n" (apply str (map f0 (sort nvseq))) "/\n"))]
    (apply str (map f1 (sort m)))))

(defn- fmt-bash [m]
  (let [ms (sort m)
        f0 (fn [[name nvseq]] (str "declare -A nml_" name "\n"))
        f1 (fn [[name nvseq]]
             (apply str
                    (map (fn [[dataref values]]
                           (let [v (string/replace values "\"" "\\\"")]
                             (str "nml_" name "[" dataref "]=\"" v "\"\n")))
                           (sort nvseq))))]
    (str (apply str (map f0 ms))
         (apply str (map f1 ms)))))

;; main


      (cond gets  (nml-out out (nml-gets m gets (:no-prefix options)))
            sets  (nml-out out (fmt (nml-sets m sets)))
            :else (nml-out out (fmt m))))))
