This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: MODULE 3: NEW TYPES OF DATA Data type: Boolean A Boolean value is either t rue or false A Boolean function produces a Boolean value Comparisons: function that consumes 2 numbers -> Boolean value (= x y) => whether x = y is true or false (< x y) => whether x < y (> x y ) => whether x is greater than y (<= x y) => whether x is less than or equal to y (>= x y) => whether x is greater than or equal to y Also, string=? and string<? Ie. (string=? this this) t rue (string=? This this) false and & or can have 2 or more arguments and => true; exactly when all of its arguments are t rue or => true; at least one of its arguments are true not => t rue; exactly when its one argument is false Substitution Rules for and (and t rue exp.) => (and exp .) (and false exp) => false (and) => true when all arguments evaluate true Substitution Rules for or (or t rue exp ) => true (or false exp ) => (or exp ) (or) => false Predicate:...
View Full Document
This note was uploaded on 05/05/2010 for the course CS 115 taught by Professor Graham during the Winter '08 term at Waterloo.
- Winter '08
- Computer Science