'Lisp insertion sort -> defun span() function confusion

I am trying to learn how lisp works. Below is a part of a insertion sort algorithm and I don't understand what it is doing as a whole. I kind of understand what predicate list is but not sure what it is checking. Could someone explain?

(defun span (predicate list)
  (let ((tail (member-if-not predicate list)))
    (values (ldiff list tail) tail)))


Solution 1:[1]

(member-if-not p l) returns a tail of l beginning with the first element for which p is false. So (member-if-not #'evenp '(2 3 4)) is (3 4) (and this is eq to the cdr of the original list in this case).

If l2 is a tail of l1 then (ldiff l1 l2) returns a list of the elements of l1 which precede it.

So

(let ((l '(2 3 4)))
  (let ((tail (member-if-not #'evenp l)))
    (values (ldiff l tail) tail)))

will return (2) and (3 4) (and the second value will be the cdr of the original list).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ignis volens