;;delete from list at index
(define delete-at-index
(lambda (k lst)
(cond ((or (null? lst)
(< k 0))
lst)
((= k 0)
(cdr lst))
((>= k (length lst))
lst)
(else (set-cdr! (cl:nthcdr (- k 1) lst)
(cl:nthcdr (+ k 1) lst))
lst))))