emacs: Add 'guix-any'.
* emacs/guix-utils.el (guix-any): New function.
This commit is contained in:
		
							parent
							
								
									ad0f31f6a5
								
							
						
					
					
						commit
						e767752c79
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue