3.) Here is a procedure that takes a list of symbols and creates a Web page containing the elements of that list in a table row.
(define (make-list-web-page syms)
`(HTML
(BODY
(TABLE
(TR ,@(symbols->tds syms))))))
The backquote `, or quasiquote, creates a list, almost like an ordinary quote. The unquote-splicing operator ,@ allows a list to be ``spliced into'' the enclosing quasiquoted list. Use the send/finish procedure in the servlet.ss Teachpack to show a Web page:
(send/finish (make-list-web-page '(some sample data)))
4.) Define a procedure make-animals-web-page that takes an input list, and returns a Web page page that shows both the input list and the result of applying remove-green-animals to that list. Use the send/finish procedure in the servlet.ss Teachpack to show the Web page. Example:
(make-animals-web-page '(deer goat alligator)) =>
(HTML
(BODY
"The input list is:"
(TABLE
(TR
(TD "deer")
(TD "goat")
(TD "alligator")))
"The output list is:"
(TABLE
(TR
(TD "deer")
(TD "goat")))))