Duh... Ignore me :) - I don't have really an explanation for what I wrote, but I got confused really badly! hehehe
On Apr 22, 5:16 pm, "Dimiter \"malkia\" Stanev" <mal...@gmail.com> wrote: > I think this might come from Common Lisp (or Scheme, not sure). > > In anycase CL also has "unless" which is exactly the opposite of > "when" - e.g. it would do the "else" part of "if". > > http://www.lispworks.com/documentation/HyperSpec/Body/m_when_.htm > > Basically some of the Common Lispers are saying that using "when" is > preffered over "if", if you don't have "else" case - this increases > the readability, etc. > > On Apr 22, 4:24 pm, e <evier...@gmail.com> wrote: > > > why is 'when' preferred ... so we know what the considerations are? Thanks > > > On Wed, Apr 22, 2009 at 6:47 PM, André Thieme > > <splendidl...@googlemail.com>wrote: > > > > On 22 Apr., 21:12, Phil Hagelberg <p...@hagelb.org> wrote: > > > > I couldn't find an equivalent to "rm -rf" in the JDK, so I wrote these > > > > functions: > > > > > (defn delete-file > > > > "Delete file f. Raise an exception if it fails." > > > > [f] > > > > (or (.delete (file f)) > > > > (throw (java.io.IOException. (str "Couldn't delete " f))))) > > > > > (defn delete-file-recursively > > > > "Delete file f. If it's a directory, recursively delete all its > > > > contents. Raise an exception if any deletion fails." > > > > [f] > > > > (let [f (file f)] > > > > (if (.isDirectory f) > > > > (doseq [child (.listFiles f)] > > > > (delete-file-recursively child))) > > > > (delete-file f))) > > > > > This seems like it would be a helpful addition to contrib, since you > > > > have to do this a lot with unit tests that write to disk in order to > > > > clean up after yourself. I can create an issue+patch if others think > > > > this is desirable. > > > > This could really be helpful for some fixtures during unit testing. > > > One minor change that I personally would make is using when vs. if > > > in delete-file-recursively. Perhaps also renaming the parameters of > > > the functions to file, although this may conflict with the function > > > file that you are using. > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---