guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

08/20: emacs: Add 'guix-any'.


From: Alex Kost
Subject: 08/20: emacs: Add 'guix-any'.
Date: Tue, 18 Aug 2015 09:41:10 +0000

alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.

commit 22e433635f59022df4087ba46d1852a225afacf5
Author: Alex Kost <address@hidden>
Date:   Wed Aug 12 15:37:20 2015 +0300

    emacs: Add 'guix-any'.
    
    * emacs/guix-utils.el (guix-any): New function.
---
 emacs/guix-utils.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 700eeec..5055186 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -204,6 +204,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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]