SICP Exercise 2.18 reverse

Exercise 2.18.  Define a procedure reverse that takes a list as argument and returns a list of the same elements in reverse order:




(reverse (list 1 4 9 16 25))
(25 16 9 4 1)

SOLUTION


The code and tests are here.

Comments

Popular posts from this blog

SICP Exercise 2.56 differentiation rule

SICP Exercise 1.28 (Miller-Rabin Test)

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions