Inefficiencies - Naive Reverse
Here is a naive definition of REVERSE
(define reverse
(lambda (l)
(if (null? l) NIL
(append (reverse (cdr l))
(list (car l))))))
APPEND copies its arguments & CDRs through its first argument, consuming both time and space
Previous slide
Next slide
Back to first slide
View graphic version