(define (f x)
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first x)
(f (rest y)))])))
(g (rest x))))
(f (list 2 3 4 5 6))
(f (list 1 2))
⇒(define (f x)
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first x)
(f (rest y)))])))
(g (rest x))))
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first (list 2 3 4 5 6))
(f (rest y)))])))
(g (rest (list 2 3 4 5 6))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y)
(cond [(empty? y) 5]
[else (* (first (list 2 3 4 5 6))
(f (rest y)))]))
(local ()
(g1 (rest (list 2 3 4 5 6))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y)
(cond [(empty? y) 5]
[else (* (first (list 2 3 4 5 6))
(f (rest y)))]))
(g1 (rest (list 2 3 4 5 6)))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y)
(cond [(empty? y) 5]
[else (* (first (list 2 3 4 5 6))
(f (rest y)))]))
(g1 (list 3 4 5 6))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y)
(cond [(empty? y) 5]
[else (* (first (list 2 3 4 5 6))
(f (rest y)))]))
(cond [(empty? (list 3 4 5 6)) 5]
[else (* (first (list 2 3 4 5 6))
(f (rest (list 3 4 5 6))))])
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(cond [false 5]
[else (* (first (list 2 3 4 5 6))
(f (rest (list 3 4 5 6))))])
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(cond [else (* (first (list 2 3 4 5 6))
(f (rest (list 3 4 5 6))))])
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(* (first (list 2 3 4 5 6))
(f (rest (list 3 4 5 6))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(* 2
(f (rest (list 3 4 5 6))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(* 2
(f (list 4 5 6)))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(* 2
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first (list 4 5 6))
(f (rest y)))])))
(g (rest (list 4 5 6)))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y)
(cond [(empty? y) 5]
[else (* (first (list 4 5 6))
(f (rest y)))]))
(* 2
(local ()
(g2 (rest (list 4 5 6)))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y)
(cond [(empty? y) 5]
[else (* (first (list 4 5 6))
(f (rest y)))]))
(* 2
(g2 (rest (list 4 5 6))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y)
(cond [(empty? y) 5]
[else (* (first (list 4 5 6))
(f (rest y)))]))
(* 2
(g2 (list 5 6)))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y)
(cond [(empty? y) 5]
[else (* (first (list 4 5 6))
(f (rest y)))]))
(* 2
(cond [(empty (list 5 6)) 5]
[else (* (first (list 4 5 6))
(f (rest (list 5 6))))]))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(* 2
(cond [false 5]
[else (* (first (list 4 5 6))
(f (rest (list 5 6))))]))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(* 2
(cond [else (* (first (list 4 5 6))
(f (rest (list 5 6))))]))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(* 2
(* (first (list 4 5 6))
(f (rest (list 5 6)))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(* 2
(* 4
(f (rest (list 5 6)))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(* 2
(* 4
(f (list 6))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(* 2
(* 4
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first (list 6))
(f (rest y)))])))
(g (rest (list 6))))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y)
(cond [(empty? y) 5]
[else (* (first (list 6))
(f (rest y)))]))
(* 2
(* 4
(local ()
(g3 (rest (list 6))))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y)
(cond [(empty? y) 5]
[else (* (first (list 6))
(f (rest y)))]))
(* 2
(* 4
(g3 (rest (list 6)))))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y)
(cond [(empty? y) 5]
[else (* (first (list 6))
(f (rest y)))]))
(* 2
(* 4
(g3 empty)))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y)
(cond [(empty? y) 5]
[else (* (first (list 6))
(f (rest y)))]))
(* 2
(* 4
(cond [(empty? empty) 5]
[else (* (first (list 6))
(f (rest empty)))])))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(* 2
(* 4
(cond [true 5]
[else (* (first (list 6))
(f (rest empty)))])))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(* 2
(* 4
5))
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(* 2
20)
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
40
(f (list 1 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
40
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first (list 1 2))
(f (rest y)))])))
(g (rest (list 1 2))))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y)
(cond [(empty? y) 5]
[else (* (first (list 1 2))
(f (rest y)))]))
40
(local ()
(g4 (rest (list 1 2))))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y)
(cond [(empty? y) 5]
[else (* (first (list 1 2))
(f (rest y)))]))
40
(g4 (rest (list 1 2)))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y)
(cond [(empty? y) 5]
[else (* (first (list 1 2))
(f (rest y)))]))
40
(g4 (list 2))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y)
(cond [(empty? y) 5]
[else (* (first (list 1 2))
(f (rest y)))]))
40
(cond [(empty? (list 2)) 5]
[else (* (first (list 1 2))
(f (rest (list 2))))])
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
40
(cond [false 5]
[else (* (first (list 1 2))
(f (rest (list 2))))])
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
40
(cond [else (* (first (list 1 2))
(f (rest (list 2))))])
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
40
(* (first (list 1 2))
(f (rest (list 2))))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
40
(* 1
(f (rest (list 2))))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
40
(* 1
(f empty))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
40
(* 1
(local ((define (g y)
(cond [(empty? y) 5]
[else (* (first empty)
(f (rest y)))])))
(g (rest empty))))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
(define (g5 y)
(cond [(empty? y) 5]
[else (* (first empty)
(f (rest y)))]))
40
(* 1
(local ()
(g5 (rest empty))))
⇒(define (f x) ...)
(define (g1 y) ...)
(define (g2 y) ...)
(define (g3 y) ...)
(define (g4 y) ...)
(define (g5 y)
(cond [(empty? y) 5]
[else (* (first empty)
(f (rest y)))]))
40
(* 1
(g5 (rest empty)))
⇒Semantics error: (rest empty)
has no meaning.