(define (list-split lst x #!optional (comp equal?)) (let ((pos (list-index (lambda (elt) (comp elt x)) lst))) (unless pos (error 'list-split "Element not in the list" x lst)) (receive (left right) (split-at lst pos) (list left (cdr right)))))