Make a destructive reverse! function in scheme
问题 I need to create a program that will reverse a list destructively. For example lets say.. scm> (define L (list 1 2 3 4)) scm> (reverse! L) (4 3 2 1) scm> L (1) Where L becomes the last element of the reversed list. I know I am supposed to use set-cdr! somehow but cannot figure out how to implement it. 回答1: Because this looks like homework, I can't give you a straight answer. I'll show you the general structure of the solution, so you can figure out the details and fill-in the blanks: (define