13. Intro Exercises 1

  1. What is wrong with this code?
;; hit-snooze?: boolean number -> boolean
(define (hit-snooze? sleepy? time)
  (and (boolean=? sleepy? "true")
       (> time 700)))
  1. Simplify or explain and correct the error.

    • (boolean=? (> 17 24) #false)
    • (boolean=? (= 1 1) "true")
    • (boolean=? practiced-piano? true)
    • (boolean=? hungry? false)
  2. 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?)
       ...)
    
  3. (Shape Sorter I.) Write fit-rect?: image -> boolean that returns true if the image fits inside a 150x100 rectangle.

  4. (Shape Sorter II.) Write ibr?: image -> boolean that returns true if the image is a (pure) blue rectangle.