Exercise 5.28. Modify the definition of the evaluator by changing eval-sequence as described in section 5.4.2 so that the evaluator is no longer tail-recursive. Rerun your experiments from exercises 5.26 and 5.27 to demonstrate that both versions of the factorial procedure now require space that grows linearly with their input. ———————————————————————————————————————————————————————————————————————— Code in 5.28-eceval.scm, with ev-sequence changes as given in the text. This version would be iterative, but without tail recursion it is not: ;;; EC-Eval input: (define (factorial n) (define (iter out n) (if (= n 1) out (iter (* out n) (- n 1)))) (iter 1 n)) (factorial 3) (total-pushes = 107 maximum-depth = 20) 6 (factorial 4) (total-pushes = 144 maximum-depth = 23) 24 (factorial 5) (total-pushes = 181 maximum-depth = 26) 120 The recursive version is still recursive, but with slightly higher values for pushes and depth. ;;; EC-Eval input: (define (factorial n) (if (= n 1) 1 (* n (factorial (- n 1))))) (factorial 3) (total-pushes = 86 maximum-depth = 23) 6 (factorial 4) (total-pushes = 120 maximum-depth = 29) 24 (factorial 5) (total-pushes = 154 maximum-depth = 35) 120 So, as expected, the change has made the iterative version run in linear space, and made code that was already recursive do a little extra work.