Exercise 4.52. Implement a new construct called if-fail that permits the user to catch the failure of an expression. If-fail takes two expressions. It evaluates the first expression as usual and returns as usual if the evaluation succeeds. If the evaluation fails, however, the value of the second expression is returned, as in the following example: ;;; Amb-Eval input: (if-fail (let ((x (an-element-of '(1 3 5)))) (require (even? x)) x) 'all-odd) ;;; Starting a new problem ;;; Amb-Eval value: all-odd ;;; Amb-Eval input: (if-fail (let ((x (an-element-of '(1 3 5 8)))) (require (even? x)) x) 'all-odd) ;;; Starting a new problem ;;; Amb-Eval value: 8 ———————————————————————————————————————————————————————————————————————— (define (analyze-if-fail exp) (let ((aproc (analyze (if-fail-first-exp exp))) (bproc (analyze (if-fail-second-exp exp)))) (lambda (env succeed fail) (aproc env succeed (lambda () (bproc env succeed fail)))))) Evaluator integration boilerplate omitted.