Created
September 11, 2010 23:24
-
-
Save kiras/575669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn close-files [col] | |
(println "closing files...") | |
(map #(.close %) col)) | |
(defn -main [& args] | |
(let [files (ref (list))] | |
(try | |
;; User can open files (in which case they will be added to the files list), | |
;; work on them, close them (in which case they should be removed from the | |
;; files list), etc. | |
(finally | |
;; Ideally the program should not exit without prompting the user about | |
;; whether to save files and would probably end up closing them earlier, | |
;; but this should ensure that the files are closed eventually. | |
(close-files @files))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment