CSC151 2010S, Class 24: Revisiting Lists Overview: * Lessons from Wednesday * Lists, As We Know Them * Lists, Some New Perspectives * Lab Admin: * Reading for Monday: Recursion Basics * Warning: the reading is complex * Expect to bring questions * Are there questions on Assignment 6? * Skip problems 5 & 6 on today's lab. * It appears that we'll have lots of missing students today. * EC for today's Peace Studies sessions (1p, 3pm, or 4:45 pm). * Exam 2 to be distributed Tuesday. Reflection and Questions from Wednesday's Lab (define rgb-brighter? (lambda (rgb1 rgb2) (if (> (rgb-brightness rgb1) (rgb-brightness rgb2)) #t #f))) vs. (define rgb-brighter? (lambda (rgb1 rgb2) (> (rgb-brightness rgb1) (rgb-brightness rgb2)))) --- (define rgb-brighter-of-two (lambda (rgb1 rgb2) (if (rgb-brighter? rgb1 rgb2) rgb1 rgb2))) --- (define rgb-4grey (lambda (rgb) (if (> 25 (rgb-brightness rgb)) grey0 (if (and (> 50 (rgb-brightness rgb)) (< 25 (rgb-brightness rgb))) grey1 (if (and (> 75 (rgb-brightness rgb)) (< 50 (rgb-brightness rgb))) grey2 (if (and (> 100 (rgb-brightness rgb)) (< 75 (rgb-brightness rgb))) grey3)))))) vs (define rgb-4grey (lambda (rgb) (if (> 25 (rgb-brightness rgb)) grey0 (if (> 50 (rgb-brightness rgb)) grey1 (if (> 75 (rgb-brightness rgb)) grey2 grey3))))) Write a new predicate, (image-contains-selection? img left top width height), that determines whether a selection using left, top, width, and height is likely to be within img. * Explanation (image-select-ellipse! img REPLACE left top width height) * left must be less than the width of the image * top must be less than the height of the image * (Note: Left can be negative.) * left can't be more negative than the width of the selection * (< 0 (+ left width)) * Do the same thing with top * (< 0 (+ top height)) (define image-contains-selection? (lambda (img left top width height) (and (< left (image-width img)) (< top (image-height img)) (< 0 (+ left width)) (< 0 (+ top height)) (< 0 width) (< 0 height)))) MAY NOT BE EXACT Lists, As We Know Them Lists, Some New Perspectives Lab