CSC151 2009F, Class 21: Boolean Values and Predicate Procedures Admin: * EC for attending Rave (since students in the class are helping plan/sponsor it) * Don't forget the cool programming languages talk today at noon. * Exams not graded. Barring continued unexpected circumstances, they will be returned Monday. * Are there questions on assignment 5? * Are there questions on problem 6 on Wednesday's lab? * Reading for Monday: Conditionals. * It's time for another Lab writeup. Do problems 2-5. * It's quiz day! (There was a parenthesization issue that I think I've fixed on every exam.) * But there will be lecture (starting ten minutes after the start of the quiz, plus or minus) * Feel free to keep working * Have a great Family Weekend! Overview: * What did you learn from the reading? * What questions did you have from the reading? * 'and' and 'or' as control structures. * Lab. Questions on Assignment 5 * None Questions on Problem 6 on Wednesday's Lab * Let vs Let* * Both bind names to valuesa * In let, the computation of the values is *simultaneous*, followed by bindings * In let*, each evaluation/binding is done in sequence * Often not an issue which you use * But if one of the expressions uses a prior name, you need let* * Example Student question, revisited > (let ((x 20) (y 20)) (+ x y)) 40 > (let ((x 20) (y x)) (+ x y)) reference to unidentified identifier: x Just to make our lives more confusing: > (define x 10) > (let ((x 20) (y x)) (+ x y)) 30 Key Concepts from the Reading * A new type, Boolean, true and false, represented as #t and #f * Predicates exist Predicate ARE procedures that return true or false Example: integer? Usually have a name that end with a question mark Exception that proves the rule: = (test for equality) * Procedures that work with Booleans: and and or * Okay, they're not quite procedures Questions from the Reading * Are the other operations, like xor? * No, but you can write them Conditional Control Structures * How do and and or work?