summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/srfi/srfi-1.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/module/srfi/srfi-1.scm b/module/srfi/srfi-1.scm
index e5b28e777..1fc7a0e26 100644
--- a/module/srfi/srfi-1.scm
+++ b/module/srfi/srfi-1.scm
@@ -731,6 +731,17 @@ the list returned."
head
(loop (cdr lst)))))))
+(define (find-tail pred lst)
+ "Return the first pair of @var{lst} whose @sc{car} satisfies the
+predicate @var{pred}, or return @code{#f} if no such element is found."
+ (check-arg procedure? pred find)
+ (let loop ((lst lst))
+ (and (not (null? lst))
+ (let ((head (car lst)))
+ (if (pred head)
+ lst
+ (loop (cdr lst)))))))
+
(define (take-while pred ls)
"Return a new list which is the longest initial prefix of LS whose
elements all satisfy the predicate PRED."