CSC151 2010S, Class 22: Boolean Values and Predicate Procedures Overview: * Questions and tips on Assignment 5. * Review: Local Bindings * Boolean values Q&A. * Lab. Admin: * Reading for Wednesday: Conditionals. * Advance warning: Exam 2 distributed next Tuesday; substitute here W-F. * EC for Thursday's Thursday Extra: (not sure). * EC for Friday's CS Table: Notes from an alum. * Racial Bias Incident Assignment 5: Questions and Tips * Can you provide insight on resetting the turtle? * Problem 1 (polygon): Should be natural. * Problem 2 (rotated): * Fortunately, the polygon procedure puts us back into the right place. * So our main problem is the angle. * Figure out how far it has turned. * Turn it back the inverse of that. * Problem 3 (scaled): Should be automatic * Tips from your colleagues * Draw pictures by hand to figure out the "trig stuff" * Start early and stop, you'll get epiphanies * For example, you don't turn by the interior angle. * Pictures help on this one Local Bindings * We learned about let * let works a lot like define, except that it lets us define values within a function * If we have a series of definitions that depend on each other, we need to nest them * Let expressions look like: (let (NAME-VALUE-PAIRS) ...) * Each name-value-pair has the form (NAME VALUE) * A typical let looks like (let ((NAME VALUE)) ...) * We can build interesting sequences of values E.g., let a be a color, let b be a redder version of a, let c be a redder version of b, etc. * let* is a nice alternative to nested lets. LAB * Thoughts on "experimentally determine" * Intent: Some thought about other components * Some of you mathematically determined those values. * An experiment is good to check your answer * Most of you said "I'm not going to try 0 1 2 3 4 ....". * Is there an efficient search strategy? (define valid-component? (lambda (c) (<= 0 c 255)))