>
>
>      (dosync (dorun (for [key ks] (alter file-seq-cache dissoc key))))
>>
>
> You might want to write (dorun (for ...)) as (doseq ...). Since you don't
> use the resulting sequence using for to generate sequence and then using to
> dorun to force it and immediately throw it away is very ugly. As a rule of
> thumb: If you need only the side-effects look for macros and functions
> starting in with "do".
>
>
Meikel,

Thanks for the tip.  I like the look of doseq even better... gets rid of one
level of nesting.  I used it on another version of the function but didn't
think to use it this time.

(defn clear-cached-files
  ([]
     (dosync (alter file-seq-cache empty)))
  ([& ks]
     (dosync (doseq [key ks] (alter file-seq-cache dissoc key)))
     @file-seq-cache))

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