Held Friday, September 29, 2000
Today we consider how to turn Scheme data into HTML.
(name eyecolor haircolor favecolor)
(define person-name (lambda (person) (car person))) (define person-eyes (lambda (person (cadr person)))) (define person-hair (lambda (person (caddr person)))) (define person-fave (lambda (person (cadddr person))))
(define person-name car) (define person-eyes cadr) (define person-hair caddr) (define person-fave cadddr)
(define summarize-person (lambda (person) (display "Vital statistics for ") (display (person-name person)) (newline) (display " Eyes are ") (display (person-eyes person)) (newline) (display " Hair is ") (display (person-hair person)) (newline) (display " Favorite color is ") (display (person-fave person)) (newline) (display "Doesn't this just make you want to love ") (display (person-name person)) (display "?") (newline)))
> (summarize-person '(Michelle reddish-brown hazel red)) Vital statistics for michelle Eyes are reddish-brown Hair is hazel Favorite color is red Doesn't this just make you want to love michelle?
a. Write the equivalent of
summarize-person for our database.
b. Test it on sample data.
c. Write a similar procedure that generates HTML instead of plain text.
Thursday, 24 August 2000
Friday, 29 September 2000
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2000F/Outlines/outline.21.html
Source text last modified Fri Sep 29 10:31:48 2000.
This page generated on Fri Sep 29 10:42:03 2000 by Siteweaver. Validate this page's HTML.
Contact our webmaster at firstname.lastname@example.org