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)
(aDEFINE (bFLATTEN X) (cFLATTEN-AUX X (dLIST))) (DEFINE (FLATTEN-AUX X Y) (eCOND (f(gNULL? X) Y) (h(PAIR? X) (iFLATTEN-AUX (jCAR X) (kFLATTEN-AUX (CDR X) Y))) (ELSE (lCONS 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 |