Recursion A
Code tracing to understand recursion.
Trace the steps of executing the Racket code.
1.
(define (rec start end)
(cond [(> start end) 0]
[else (+ start
(rec (+ 1 start) end))]))
(rec 5 1)
(rec 5 5)
(rec 5 6)
(rec 5 7)
(rec 10 20)
(rec 3 3.14)
2.
(define (dsq x y)
(cond [(> x y) (star x "solid" "purple")]
[(= x y) (square x "outline" "blue")]
[else (overlay (square x "outline" "blue")
(dsq (+ x 25) y))]))
(dsq 30 30)
(dsq 40 65)
(dsq 40 90)
(dsq 40 50)