CSC151 2007S, Class 36: More Efficient Pixel Maps, Revisited * I will continue to reserve time at the start of class for discussion of campus issues. Admin: * Are there questions on Assignment 8? * Reading for tomorrow: Color Palettes. * Extra credit for attending the "Opposed to Toy Trains" (Con Brio) concert Wednesday, 9:30ish, The Pub * Extra credit for attending the symphonic band on the 20th in Sebring-Lewis hall * Grant plays sax * David plays euphonium * Extra credit for applied studio recital noon on Thursday in Sebring-Lewis. * Matt plays cello Overview: * Notes on Quiz 7 * Quick review. * More time for lab. ==Notes on the Quiz== (define image-write-pixmap (lambda (image filename) (let ((width (image-width image)) (height (image-height image)) (port (open-output-file filename))) (let kernel ((col 0) (row 0)) (cond ((>= row height) (close-output-port port) image) ((>= col width) (kernel 0 (+ row 1))) (else (rgb-write (image-get-pixel image col row) port) (kernel (+ col 1) row))))))) What is the purpose of the first let expression? Names three values, width, height, and port. width is the width of the image height is the height of the image port is a port associated with the given file * These values are local to the procedure * Naming increases readability * Naming increases efficiency What is the purpose of the second let expression? * Defines a RECURSIVE PROCEDURE (named kernel) of two parameters, col and row * The procedure steps through the positions in the image, writing the colors as it goes. ==Lab Comments == * Last fall, we used image.WHATEVER rather than image-WHATEVER. A few bits of code still have the old form, but we're working on fixing it.