Spring 2017

Phillip Bradford

CSE 1729

CSE 1729 Exam 2 Study Guide Week 5: Sum Function (∑): (define (sum n) (if (= n 0) 0 (+ n (sum (- n 1))))) Product Function (∏): (define (prod n) (if (= n 1) 1 (* n (prod (- n 1))))) “let” does not use let environment to define terms Ex: (define x 10) (define (f n) (let ((x 50) (y (+ x n)))) (+ x y))) (f 100) 160 -> 50 (x inside let) + 110 (y made using outside x (10) plus 100) Sum Function for Func