Testing whether lambda expression returns true for any list element I have the following function defined in my .emacs to test if a given executable exists within my $PATH. I implemented it with cl-reduce and the code looks really unidiomatic (to me).

(defun executable-in-path-p (executable)
  "Test if EXECUTABLE exists in path."
  (eq t (cl-reduce
         (lambda (path exists)
           (or (file-exists-p (concat (file-name-as-directory path) executable))
               exists))
         exec-path)))


Is there a more concise way to test if a list, mapped with a predicate function, has at least one element equal to t than this?

(eq t
    (cl-reduce
     (lambda (element acc)
       (or (some-check-p element)
           acc))
     some-list))


In Ruby for example I would write:

some_list.any? { |element| some_check(element) }
If you already have Common Lisp-derived functions in there, use CL-SOME instead:

(defun executable-in-path-p (executable)
  "Test if EXECUTABLE exists in path."
  (cl-some (lambda (path) (file-exists-p (concat (file-name-as-directory path) executable))) exec-path))


That's of course a little bit different than explicitly checking for t, but you shouldn't be doing that anyway in most cases (everything but nil is already true).