;; rotate list (define rotate (lambda (lst amt) (let loop ((l (if (> amt 0) (reverse lst) lst)) (cnt (abs amt))) (if (<= cnt 0) (if (> amt 0) (reverse l) l) (loop (append (cdr l) (list (car l))) (- cnt 1))))))