; Call expressions (+ 1 2 3 4) (+) (*) (- 12) (- 20 1 2 3 4 5) (* (* 2 2 2 2 2 3 3) 7) (number? 12) (integer? 3.3) (zero? 2) ; Definitions (define (square x) (* x x)) (define (average x y) (/ (+ x y) 2)) (define (abs x) (if (< x 0) (- x) x)) (define (sqrt x) (define (improve guess) (average guess (/ x guess))) (define (sqrt-iter guess) (if (= (square guess) x) guess (sqrt-iter (improve guess)))) (sqrt-iter 1)) ; List demos (cons 1 2) (cons 1 (cons 2 nil)) (cons 1 (cons 2 (cons 3 4))) (cons (cons 1 2) 2) (cons (cons 1 2) nil) (cons (cons 1 (cons 2 nil)) nil) (cons (cons 1 2) (cons 3 nil)) (pair? (cons 1 2)) (pair? (cons 1 (cons 2 nil))) (pair? nil) (null? nil) (null? (cons 1 2)) (list 1 2) (list 1 2 3 4) (cdr (list 1 2 3 4)) (define x (cons 1 2)) (list (car x) (cdr x)) (cons (car x) (cons (cdr x) nil)) (define (length items) (if (null? items) 0 (+ 1 (length (cdr items))))) (define squares (list 1 4 9 16 25)) (length squares)