[plt-scheme] restart exception handling?

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Jul 13 21:10:29 EDT 2008

On Jul 13, Matthew Flatt wrote:
> [...]
> 
>    (define (mega-fun x y z)
>      (let ([x (if (not (integer? x))
>                   (raise-continuable-type-error 'mega-fun "integer" x)
>                   x)])
>        (let ([y (if (not (list? y)) ....)])
>          ....)))

You mean

  (define (mega-fun x y z)
    (let ([x (let loop ([x x])
               (if (not (integer? x))
                 (loop (raise-continuable-type-error 'mega-fun "integer" x))
                 x))])
      ...))

[which could be asbtracted by some

  (define (must-be-integer who x)
    (if (integer? x)
      x
      (must-be-integer (raise-continuable-type-error who "integer" x))))

]

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.