From e767752c79975d30341f71d7f9de88edeb192d59 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 12 Aug 2015 15:37:20 +0300 Subject: emacs: Add 'guix-any'. * emacs/guix-utils.el (guix-any): New function. --- emacs/guix-utils.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el index 3157f6359b..fb1ca60654 100644 --- a/emacs/guix-utils.el +++ b/emacs/guix-utils.el @@ -215,6 +215,14 @@ accessed with KEYS." (while (re-search-forward ,regexp nil t) ,@body))) +(defun guix-any (pred lst) + "Test whether any element from LST satisfies PRED. +If so, return the return value from the successful PRED call. +Return nil otherwise." + (when lst + (or (funcall pred (car lst)) + (guix-any pred (cdr lst))))) + ;;; Diff -- cgit 1.4.1