Trying to rotate a list left in scheme/racket.
For example: (rotate-left ‘(abc)) outputs (bca)
Here’s ze code!
(define (rotate-left LIST)
(if(null? LIST)'()
(cons(car LIST)(cons(cdr LIST)'())))))
Unfortunately this just outputs the same list! Should be an easy fix I’m sure, and I know I’m close…Thanks for any help !
You got car and cdr backwards ! Here you go :