tests if x comes before y in the specified list
(defun before (x y lst &key (test #'eql))
"tests if x comes before y in the specified list"
(and lst
(let ((first (car lst)))
(cond ((funcall test y first) nil)
((funcall test x first) lst)
(t (before x y (cdr lst) :test test))))))Source Context