I already have the code to reverse a list:
(define (myreverse lst)
(if (null? lst)
lst
(append (reverse (cdr lst))
(list (car lst)))))
But I want to do this using only lectrec
, cons
, car
and cdr
. How can I do that?