CSC151.01 2014F, Class 18: Programming the GIMP Tools ===================================================== * Continue partners from Friday. _Overview_ * Preliminaries. * Admin. * Upcoming Work. * Extra Credit. * Questions. * Not-so-quick Notes on Lambda Expressions. * Questions about the readings. * Lab. * Return exams. Preliminaries ------------- ### Admin * Welcome to any prospective students we may have! * Office hours (modified due to meetings): * Monday 3:15-4:45 * Tuesday 8:00-9:45 * Wednesday 8:00-9:45 * Thursday 8:00-9:45, 2:15-3:15 * Friday 1:45-3:15 (also Walking hours 1:15-1:45) * Let me know by 5pm today if you want to work alone on the next HW. * Reflections on partners. * *I appreciate the thoughtful comments I've received.* * Some feel very strongly that letting some people choose partners will disadvantage those who don't choose their own partners. * Scheduling is a problem. * One person suggested "No partners, but you can talk to anyone". I worry that this model means that some people will be much slower than others (partnering does help even things out). * One person suggested that groups make a policy that you rotate who is at the keyboard. * Would pairs rather than groups of 3 be better for scheduling? * To provide you with incentive to take your own notes on each topic we cover: If you send me a summary of what you think are the important takeaways from any reading/lab combination, I will comment on your summary. * We'll talk for a little bit about lambdas. (This will reprise some things we talked about at the Thursday review session.) ### Upcoming Work * No lab writeup today (no matter what it says online). * Reading for Tuesday: * [Conditionals](../readings/conditionals-reading.html) * HW4 is due tomorrow. ### Fun Things with no Extra Credit Value * GHS Homecoming Parade Thursday at 5:30 pm. (Small town Iowa homecoming is a fascinating experience.) * Friends of Drake Library Book Sale, Friday night and Saturday. At about 11 am on Saturday, you can get a box of books for a buck. (Earlier, it's 50 cents for paperbacks and $1 for hardcovers.) ### Extra Credit Opportunities #### Academic * Campus Town Hall Tuesday at noon or 7:30 p.m. * CS extras next Thursday: Alumni * CS table Friday: Serendipity and Computing (with Grinnell's Artist in Residence) * Grinnell Prize events the following week (particularly events related to the prize winners whose project involves Web tools) #### Peer Support * Anna Christie, Oct. 9-12 (SB plays Marthy) * Football (???) * Men's Tennis (???) * Women's Tennis (???) * Swimming (???) * Evan's radio show 5pm Friday nights on KDIC * Donna's radio show Sunday midnight on KDIC #### Miscellaneous * Participate in #GrinWell. * Friends of Drake Library needs help setting up for their annual booksale on Thursday, October 2 (conveniently, the same night as Grinnell High School's homecoming parade). You can help a good cause and probably get a few free books, too. * Update: They can also use help on Wednesday, October 1. * 5pm-7pm both nights. ### Questions Not-so-quick Notes on Lambda Expressions ---------------------------------------- A problem related to the quiz. Given an image, picture, modify the picture to increase all of the red components by 20%, set the green to 0. (image-transform! picture TRANSFORMATION) (define yeahidunno (lambda (color) (irgb (bound-component (* 1.2 (irgb-red color))) 0 (irgb-blue color)))) ; Assume (bound-component val) bounds val to the range 0 .. 255. (image-transform! picture yeahidunno) In Scheme, you can always substitute a value for its name. (image-transform! picture (lambda (color) (irgb (bound-component (* 1.2 (irgb-red color))) 0 (irgb-blue color)))) If we use this strategy, we don't need to come up with a name for the procedure (but we could if forced to). In this problem, we didn't need the internal lambda, but it helped. In other problems, we may need an iinternal lambda. A variant of the previous problem: Write a procedure, `(enhance-blue! image percent)`, increase blue component by that percent. We'll assume that percentages are reprsented as decimals. E.g., 25% is 0.25. (image-transform! picture TRANSFORMATION) (define color-enhance-blue (lambda (color) (irgb (irgb-red color) (irgb-green color) (* (+ 1 percent) (irgb-blue color))))) (define enhance-blue! (lambda (image percent) (image-transform! picture color-enhance-blue))) Whoops! Doesn't work. Let's try the substitution anyway (define enhance-blue! (lambda (image percent) (image-transform! picture (lambda (color) (irgb (irgb-red color) (irgb-green color) (* (+ 1 percent) (irgb-blue color))))))) Questions about the readings ---------------------------- Lab --- * I don't know why the rectangle is grey.