It's also worth noting that you can translate the Ruby code almost
line for line if you make use of Clojure's atoms to adopt a more
"imperative" approach.  In general, it's more satisfying to find a
pure functional way to solve a problem, but while you're transitioning
from Ruby, it's not unreasonable to copy Ruby's style in localized
contexts.

For example (untested),

(defn get-acl-access-data [file]
  (let [acl (split (slurp file) #"\n"),
        access (atom {})]
    (doseq [line acl]
      (let [[avail user-string path] (split line #"\|")]
        (when (not= avail "avail")
          (doseq [user (split user-string #"\,")]
            (swap! access update user conj path)))))
    @access))

Note that this makes use of an "update" function that really should be
in the core, but isn't:
; This should be in core
(defn update [m k f & args]
  (apply update-in m [k] f args))

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