Thursday's Exercise Solutions Exercise 2: + ;Valid, value is primitive procedure for addition 2 * 3 ;Kinda valid, it's really 3 expressions (2 * 3) ;Invalid, first subexpression must be a procedure ;error: 2 is not applicable (* 2 3) ;Valid, value is 6 ((* 2 3)) ;Invalid, (* 2 3) evaluates to 6, which is not a procedure for the ; outer combination -3 ;Valid, value is -3 - 3 ;Kinda valid, it's two expressions (- 3) ;Valid, value is -3 (subtraction procedure applied to one argument) (define x 3) ;Valid, value is unspecified (define x 4 5 6) ;Invalid, more than one value-exp provided (define x * 1 2) ;Invalid, more than one value-exp provided Exercise 3: plan: takes in two numbers, x and y keep subtracting y from x until x is less than y what's left over is the remainder (define remainder (lambda (x y) (if (< x y) x (remainder (- x y) y)))) Exercise 4: plan: use remainder if y divides x with no remainder, x is divisible by y. (define divisible? (lambda (x y) (= (remainder x y) 0)))