From 0166e7f200dcf908b5224cb00b2aaccf7d429680 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 19 Jan 2005 23:35:38 +0000 Subject: [PATCH] (SRFI-1 Searching): In list-index, note 0 based index and #f for not found. --- doc/ref/srfi-modules.texi | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi index 0209535cf..edc5ccd31 100644 --- a/doc/ref/srfi-modules.texi +++ b/doc/ref/srfi-modules.texi @@ -706,8 +706,20 @@ If one of @var{lst1} @dots{} @var{lstN} is empty then no calls to @var{pred} are made, and the return is @code{#t}. @end deffn -@deffn {Scheme Procedure} list-index pred lst1 lst2 @dots{} -Return the index of the leftmost element that satisfies @var{pred}. +@deffn {Scheme Procedure} list-index pred lst1 @dots{} lstN +Call @var{pred} on sets of elements from the @var{lst}s, one from each +list, starting from the first, as @code{(@var{pred} elem1 @dots{} +elemN)}. Return the index of the first set for which @var{pred} +returns true. + +The index starts from 0 for the first first set of elements. +Searching stops when the end of the shortest @var{lst} is reached. If +no set of elements pass then the return is @code{#f}. + +@example +(list-index odd? '(2 4 6 9)) @result{} 3 +(list-index = '(1 2 3) '(3 1 2)) @result{} #f +@end example @end deffn @deffn {Scheme Procedure} member x lst [=]