unwind-protect is indeed a Common Lisp form, not Clojure.  It ensures
that a given piece of code is always executed, even when an error or
some other condition causes the code to exit early.

In Clojure (and Java), the nearest equivalent is the try-catch-finally
block.  It looks like this:

(try
   ... code that may throw an exception ...
   (catch Exception ex
      ... handle an exception ...)
   (finally
      ... always do this, no matter what ...))

The "finally" block is always guaranteed to run, barring some
catastrophic failure like the JVM crashing.

-SS


On Sep 15, 11:54 am, Gorsal <s...@tewebs.com> wrote:
> I was just wondering about the unwind-protect form, I've heard that it
> doesn't protect against certain types of exits, but what exactly are
> these exits? I've heard return, break, and continue statements said
> but i can't seem to find these statements in clojure. Any examples?
--~--~---------~--~----~------------~-------~--~----~
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