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