We trained hard, but it seemed that every time we were beginning to form up into teams, we would be reorganized. I was to learn later in life that we tend to meet any new situation by reorganizing; and a wonderful method it can be for creating the illusion of progress while producing confusion, inefficiency, and demoralization.- Petronius Arbiter, 210 BC
(define (fact n) (if (= n 0) 1 (* n (fact (- n 1)))))Hint: use use a helper function of two arguments. (6 points)
Some of the rows have already been marked for you. (2 points/row = 14 points)
(_{a}DEFINE (_{b}FLATTEN X) (_{c}FLATTEN-AUX X (_{d}LIST))) (DEFINE (FLATTEN-AUX X Y) (_{e}COND (_{f}(_{g}NULL? X) Y) (_{h}(PAIR? X) (_{i}FLATTEN-AUX (_{j}CAR X) (_{k}FLATTEN-AUX (CDR X) Y))) (ELSE (_{l}CONS X Y))))
paren | tail-recursive function call | non- tail-recursive function call | not a function call |
---|---|---|---|
a | X | ||
b | X | ||
c | X | ||
d | X | ||
e | |||
f | |||
g | |||
h | X | ||
i | |||
j | |||
k | |||
l |