Functional Problem Solving (CSC 151 2015S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] - [Calendar]
Current: [Assignment] [EBoard am] [EBoard pm] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards am] [EBoards pm] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014F)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Book Office Hours] - [Issue Tracker (Course)]
Overview
equal? and = both give truth values as output.
check-equal? and check-=and and or are functions that take
Boolean input values and give Boolean outputs. not.and, or, or not means?
and - if both inputs are true, the output is trueor - if either input is true, the output is truenot - if the input is true, the output is falseUsing that definition, what is the value of (and #t #f)?
input/a
AND True False
i n True True False p u False False False t / b
input/a
OR True False
i
n True True True
p
u False True False
t
/
b
Create the implies function
input/a
=> True False
i
n True True False
p
u False True True
t
/
b
List all the cases in which => holdsa
(and (not a) b)(and (not a) (not b))(define => (lambda (a b) (or (and a b) (and (not a) b) (and (not a) (not b)))))
A good strategy: Gives you long answers, but gives you an answer
Simplifying the answer: If b holds, we don't care about a
(define =>
(lambda (a b)
(or b (and (not a) (not b)))))
Another approach: Just eliminate the falses
(define =>
(lambda (a b)
(not (and a (not b)))))
Will we know whnat to do in the other cases?
New Question: How many different Boolean functions are there?