Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
List Reversal
; 2.18
(define (reverse list)
(define (iter-list reversed-list unprocessed-remaining)
(if (null? unprocessed-remaining)
(iter-list (cons(car unprocessed-remaining) reversed-list) (cdr unprocessed-remaining))
(iter-list null list))
(reverse (list 3 4 5 6)) ;---> 6 4 5 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.