This assignment is out of 100 points. The bonus question can give you an extra 40 points.
Do problems 5 and 7 on pages 423 to 424 of the text (Sebesta, 7th edition).
Define macros my-lambda and my-return that use continuations to implement a return statement in Scheme. More specifically, my-lambda should be usable in exactly the same way as a normal Scheme lambda (in fact, you should use a lambda as part of its implementation.) However, a function f, created by a my-lambda, contains a sub-expression (my-return result), and this expression is evaluated, then result should be returned immediately as the result of the call to f.
Use continuations to implement a iterator/yield construct that can be used to make generic iterators. You must also define functions has-next? and get-next to access the values of the iterator. These should be used together as follows:
Example:
;; Create an iterator
(define my-it (iterator
;; Sprinkle some yield statements throughout
(yield 7)
(if (> a b) (yield a))
(do ((i 0 (+ i 1)))
((> i b))
(yield i) )
(yield 8) ))
;; Add up the values it returns
(do ((s 0)) ;; local variable for sum
((not (has-next? my-it)) s) ;; return sum when done
(set! s (+ s (get-next my-it))) )
XSLT can be used to in web servers to customize the web-pages that are served to different kinds of devices. For example, web pages served to cell-phones should be laid yout in a compact manner. In this exercise you will write a simple XSLT stylesheet which performs such a task.
Write an XSLT stylesheet to replace <img> elements with the text that is present in their alt="..." attribute (if one is given), or their src="..." attribute (if no alt is given). Your stylesheet should replace only the img tags, and leave the page otherwise unchanged.
Provide a suitable set of input test cases, and show the resulting outputs. Note that your input HTML must also be legal XML. For this reason, your img tags should be written as
<img src="..." alt="..."> </img>
Write an XSLT style sheet to transpose a rectangular HTML table of arbitrary size. E.g. the table
<table> <tr> <td>a</td> <td>b</td> <td>c</td> </tr> <tr> <td>d</td> <td>e</td> <td>f</td> </tr> </table>should be transformed to
<table> <tr> <td>a</td> <td>d</td> </tr> <tr> <td>b</td> <td>e</td> </tr> <tr> <td>c</td> <td>f</td> </tr> </table>Provide a test file and output showing the stylesheet transposing a matrix of size 2x3 and also of size 4x3.