Am Mo., 8. Juni 2020 um 16:29 Uhr schrieb John Cowan <xxxxxx@ccil.org>:

Completely untested implementation:

(define (exception->either pred thunk)
  (with-exception-handler
    (lambda (e)
      (if (pred e) (left e) (raise-continuably e)))
    (lambda () (call-with-values thunk right))))

You should use `guard' as in my sample implementation, not `with-exception-handler' because it is an error if the exception handler returns. `guard' uses a lot of call/cc trickery to prevent this.  Or use call/cc yourself, but there is no need to reinvent the wheel.