Evaluation types
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (f a)
(sum-of-squares (+ a 1) (* a 2)))
evaluate operator and operands
use procedures with arguments (1)
(f 5) ->
(sum-of-squares (+ 5 1) (* 5 2)) ->
(sum-of-squares 6 10) ->
(+ (square 6) (square 10)) ->
(+ (* 6 6) (* 10 10)) ->
(+ 36 100) ->
136
get expression with simple operations
execute expression
(sum-of-squares (+ 5 1) (* 5 2))
(+ (square (+ 5 1)) (square (* 5 2)))
(+ (* (+ 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)))
(+ (* 6 6) (* 10 10))
(+ 36 100)
136