Codebase list ohcount / 420c4794-75b8-4551-a2c5-42f5fb1d3fbf/main test / src_dir / scheme.scm
420c4794-75b8-4551-a2c5-42f5fb1d3fbf/main

Tree @420c4794-75b8-4551-a2c5-42f5fb1d3fbf/main (Download .tar.gz)

scheme.scm @420c4794-75b8-4551-a2c5-42f5fb1d3fbf/mainraw · history · blame

(+ 1 (/ 1 0) 3)
; => A divide by zero error is raised

(with-failure-continuation
    (lambda (error-record error-k)
      'error)
  (lambda () (+ 1 (/ 1 0) 3)))
; => The symbol 'error

(with-failure-continuation
    (lambda (error-record error-k)
      (error-k 2))
  (lambda () (+ 1 (/ 1 0) 3)))
; => 6

(with-failure-continuation
    (lambda (error-record error-k)
      (throw error-record error-k))
  (lambda () (+ 1 (/ 1 0) 3)))
; => A divide by zero error is raised

(with-failure-continuation
    (lambda (error-record error-k)
      (throw (make-error '/ "could not perform the division.") error-k))
  (lambda () (+ 1 (/ 1 0) 3)))
; => An error is raised: Error in /: could not perform the division.

(with-failure-continuation
    (lambda (error-record error-k)
      (error 'example-function "could not evaluate the expression."))
  (lambda () (+ 1 (/ 1 0) 3)))
; => An error is raised: Error in example-function: could not evaluate the expression.