from ac.scm: ; If an err occurs in an on-err expr, no val is returned and code
; after it doesn't get executed. Not quite what I had in mind.
(define (on-err errfn f)
((call-with-current-continuation
(lambda (k)
(lambda ()
(with-handlers ((exn:fail? (lambda (c)
(k (lambda () (errfn c))))))
(f)))))))
(xdef 'on-err on-err)
I didn't follow the comment... what was the desired behavior? arc> (on-err (fn (c) 'oops) (fn () (do1 (/ 8 4) (prn "here"))))
here
2
arc> (on-err (fn (c) 'oops) (fn () (do1 (/ 8 0) (prn "here"))))
oops
arc>
|