;;; CONDITIONS 2: UNWIND-PROTECT (solution) (defparameter *lid* :closed) (defun with-lid (f) (unwind-protect (progn (setf *lid* :open) (funcall f)) (setf *lid* :closed))) ;;; ------------------------------------------------------------------ ;;; Checks. Read them - they tell you what to aim for - but leave ;;; them unchanged. ;;; ------------------------------------------------------------------ (check (progn (with-lid (lambda () 1)) (eq :closed *lid*))) (check (handler-case (progn (with-lid (lambda () (error "oops"))) nil) (error () t))) (check (eq :closed *lid*))