(defun mostn (fn lst) (if (null lst) (values nil nil) (let ((result (list (car lst))) (max (funcall fn (car lst)))) (dolist (obj (cdr lst)) (let ((score (funcall fn obj))) (cond ((> score max) (setq max score result (list obj))) ((= score max) (push obj result))))) (values (nreverse result) max))))Source Context