13. Intro Exercises 2
-
Simplify, explain and correct errors if needed.
(and (< x 10) (> x 3) (< x 12))
(or (= 0 1) (< 15 8) (string=? "dog" "DOG"))
(not (= (+ 1 3 7 9) (+ 2 4 6 8)))
(boolean=? (or (boolean=? lunchtime? true) study-hall?) false)
-
What does this function do? Is there any possibility of an error.
(define (mystery? n)
(or (= n 0)
(< 15 (/ 100 n))))
- Does writing the function above in a different way matter?
(define (mystery2? n)
(or (< 15 (/ 100 n))
(= n 0)))
-
(Challenge) The
lucky-charm? : image -> boolean
. Give true if the image matchespic:unicorn
(you can pick this image) or an orange star (must work for every size orange star). Write some check-expects first!(check-expect (lucky-charm? (star 20 "solid" "orange")) true) (check-expect (lucky-charm? (star 30 "solid" "orange")) true) (check-expect (lucky-charm? pic:hacker) false) (check-expect (lucky-charm? pic:unicorn) true)