(I'd say something about my own particular idiom, but that's more of a
Python thing.)

Anyway, new to Clojure but not to Lisp or Java.  Writing something to
interoperate with some Perl code that stores a hash in a simple flat
file syntax:

key1<tab>value1<newline>key2<tab>value2<newline>...

sorted on the keys.

These are my load and save routines; the load has nothing to handle
misformatted files yet, but I'm just looking to get a feel for
idiomatic Clojure.  Do these look reasonable?  The save routine feels
a little clunky to me.

(defn load-map [filename]
    (apply sorted-map (re-seq #"[^\n\t]+" (slurp filename))))

(defn save-map [the-map filename]
    (doto (java.io.FileWriter. filename)
        (.write (apply str (interleave (apply concat (seq the-map)
(cycle "\t\n")))) (.close)))

-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to