Hacker News new | past | comments | ask | show | jobs | submit login

A try-catch block?

  (handler-case (/ 1 0)
     (division-by-zero (condition)
       (format nil "We caught ~S." condition))
     ((or file-error parse-error type-error) (condition)
      (format nil "We should never catch ~S" condition))
     (:no-error (result)
       (declare (ignore result))
       "We should never get here."))
That's an example of how it can be done in CL, in Scheme you've got guard.

  (guard (con
          ((warning? con)
           "We should never get this.")
          ((assertion-violation? con)
           "We should get this."))
    (/ 1 0))



Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: