3.) Using only cons, car, cdr, null, and x
and y (no defines or lists, no quotes), enter expressions
that evaluate to each of the following. Use a single expression
to produce each result.
(b a y) ((b a y)) (c a b) ((c) a b) (x y) ((x) (y)) ((x) ((y)))
4.) In DrScheme, choose Language | Add Teachpack.
Add the Teachpack servlet.ss. Press the Execute button.
In the interactions (lower) window, you should see that the
Teachpack has been added.
In the definitions (upper) window, enter the expression
(define html '(HTML (BODY (TABLE (TR (TD "Hello") (TD "world"))))))
Press the Execute button again. This definition binds html to a list, which you can verify by entering html in the interactions window. The quote notation gives yet another way to create a list. The first element of the list is the symbol 'HTML.
In the definitions window, add the line (send/finish html) at the bottom.
The Teachpack converts this list to HTML:
<HTML> <BODY> <TABLE> <TR><TD>"Hello"</TD> <TD>"world"</TD> </TR> </TABLE> </BODY> </HTML>
and sends it to the browser. Note that the list representation is more compact than ordinary HTML, but contains the same information.
Using just cons, null, symbols and strings, create a second definition html2 that yields the same list. Press Execute -- a browser should appear. To verify your solution, change the last line to (send/finish html2) and press Execute again. If your solution for html2 is correct, you'll see the same Web page again.