13. Intro Exercises 1
- Use the code below to answer:
;; hit-snooze?: boolean number -> boolean
(define (hit-snooze? sleepy? time)
(and (boolean=? sleepy? "true")
(< time 700)))
- What is wrong with this code? Fix it.
- Write a check-expect where this function returns true.
- Write a check-expect where this function returns false.
-
Simplify or explain and correct the error.
(boolean=? (> 17 24) #false)
(boolean=? (= 1 1) "true")
(boolean=? practiced-piano? true)
(boolean=? hungry? false)
-
Sometimes you get to sleep a lot (return true). That happens if you did not have homework, did not do the homework you have, or the homework was easy.
Write a function to figure out if you slept a lot.
(define (slept-lots? had-hw? did-hw? was-easy?) ...)
-
(Shape Sorter I.) Write
fit-rect?: image -> boolean
that returns true if the image fits inside a 150x100 rectangle. -
(Shape Sorter II.) Write
ibr?: image -> boolean
that returns true if the image is a (pure) blue rectangle.