CP104 Lecture Notes - Lecture 5: Function Application, Boolean Expression, Boolean Function

40 views4 pages
25 Sep 2016
School
Course
hayjayshay and 38575 others unlocked
2
Verified Note
2 documents

Document Summary

Boolean value is either true or false boolean function produces a boolean value. Comparison is a function that consumes two numbers and produces a boolean value (< x y) ex: (> 3 1) true. Mathematical statements combined by using and, or, not. Ex: 3 x < 7 (and (<= 3 x) (< x 7)) The arguments of and and or are evaluated in order from left to right. Boolean function that determines if data is of a particular form. Each argument of cond is a question/answer pair. The answer is a possible value of the conditional expression. Sometimes expressions should take different values under different conditions. Ex: |a| (cond [(< x 0) (- x)] [(> = x 0) x]) The questions are evaluated in order; as soon as one evaluates to true, the corresponding answer is evaluated and becomes the value of the whole expression no further questions are evaluated.

Get access

\$8 USD/m\$10 USD/m
Billed \$96 USD annually
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class