Building on Exercise 6.35, show how to implement exceptions using call with- current-continuation in Scheme. Model your

Question:

Building on Exercise 6.35, show how to implement exceptions using call with- current-continuation in Scheme. Model your syntax after the handler-case of Common Lisp. As in Exercise 6.35, you will probably need define-syntax and dynamic-wind.

Data From Exercise 6.35:

Use call-with-current-continuation (call/cc) to implement the following structured nonlocal control transfers in Scheme. You will probably want to consult a Scheme manual for documentation not only on call/cc, but on define-syntax and dynamic-wind as well.

As in that previous exercise, your implementation should support expressions like

(for-iter (lambda (e) (display e) (newline)) (uptoby 10 50 3))

Where the implementation of uptoby in Exercise 6.34 required the use of delay and force, however, you should provide an iterator macro (a Scheme special form) and a yield function that allows uptoby to look like an ordinary tail-recursive function with an embedded yield:

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: