Module 3 -Cs 115

Module 3 -Cs 115 - MODULE 3: NEW TYPES OF DATA Data type:...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 5

Module 3 -Cs 115 - MODULE 3: NEW TYPES OF DATA Data type:...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online