Code: Select all
(define (f x y)
(if (= 0 x)
(throw "x can't be zero")
(+ x y)))
> (catch (f 0 2) 'result)
true
>result
"x can't be zero"
> (catch (f 1 1) 'result)
true
> result
2
Eddie
Code: Select all
(define (f x y)
(if (= 0 x)
(throw "x can't be zero")
(+ x y)))
> (catch (f 0 2) 'result)
true
>result
"x can't be zero"
> (catch (f 1 1) 'result)
true
> result
2
Code: Select all
(define (func x y)
(if (= x 0) (what-ever-makes-an-error-condition "X can't be zero") (+ x y)))
Code: Select all
(define (sendmail to from subject body)
(string
(exec "/usr/bin/sendmail -t"
(format "To: %s\nFrom: %s\nSubject: %s\n\n%s."
to from subject body))))
Code: Select all
(define (sendmail to from subject body)
(exec "/usr/bin/sendmail -t"
(format "To: %s\nFrom: %s\nSubject: %s\n\n%s"
to from subject body))))