[racket] Dirt-simple exceptions

From: Mark Carter (mcturra2000 at yahoo.co.uk)
Date: Sun Sep 5 08:36:16 EDT 2010

I can't get my head around Racket's exception mechanism. I want to say "try 
something, and if it fails, return a specified default value".

This returns the expected result:
   (with-exception-handler (lambda (x) "Oops") (/ 1 0))
because it returns "Oops". However, if I type
   (with-exception-handler (lambda (x) "Oops") (/ 6 2))
then I also get "Oops". It should return 3.

Is there a simple way to accomplish what I'm looking for?



      


Posted on the users mailing list.