(define (create-polygon ptlist)
(if (null? ptlist) 0
(append (list (make-seg (car ptlist) (cadr ptlist))) (create-polygon (cdr ptlist)))))
My problem is whenever I try to run this program it gives contract violation error. I know that you can't car or cdr empty lists but I'm checking if it's empty or not. So what is the problem here?