I am doing ex2.22 of SICP, the exercise gives a procedure which intends to square a list but the output reverses the list. But when I type it in DrRacket the output is unexpected. The code:
(define (square-list items)
(define (iter things answer)
(if (null? things)
answer
(iter (cdr things)
(cons (square (car things))
answer))))
(iter items null))
(square-list (list 1 2 3))
The expected output is (9 4 1) but actually it is '(#<procedure> #<procedure> #<procedure>)
.I just don't know why.