Don't be afraid to split your work across multiple functions. Not
only is this clearer, but you can then test the functions
independently. So something like this:
(defn access-map-add-users [access-map users path]
(apply merge-with into access-map
(for [user users] {user [path]})))
(defn access-map-add-line [access-map line]
(let [[avail user-string path] (split line #"\|"),
users (split user-string #"\,")]
(cond
(not= avail "avail") access-map ; no change to access-map
:else (access-map-add-users access-map users path))))
(defn get-acl-access-data [file]
(let [acl-lines (split (slurp file) #"\n")]
(reduce access-map-add-line {} acl-lines)))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en