> Clojure does not seem to support iteration inside catch or finally  
> forms.

Apparently not directly. Splitting the iteration into a separate named  
function works, though:

(defn print-seq [foo]
   (doseq [x foo]
     (println x)))

(let [foo (atom [1 2 3])]
   (try
     (throw (new Exception "foo"))
   (catch Exception e
     (print-seq @foo))))


so you could try

(defn close-all-files [files]
   (doseq [file files]
     (.close file)))

(let [files (atom [])]
   (try
     (open-my-many-files files)
     ;; the files atom now refers to a vector of open file handles
     (do-dangerous-io @files)
     (finally
       (close-all-files @files))))

-R

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

Reply via email to