mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 21:10:27 +02:00
A bit clearer for:
(SRFI-1 Searching): In list-index, note 0 based index and #f for not found.
This commit is contained in:
parent
83743da077
commit
d1736abf82
1 changed files with 6 additions and 7 deletions
|
@ -743,14 +743,13 @@ If one of @var{lst1} @dots{} @var{lstN} is empty then no calls to
|
|||
@end deffn
|
||||
|
||||
@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.
|
||||
Return the index of the first set of elements, one from each of
|
||||
@var{lst1}@dots{}@var{lstN}, which satisfies @var{pred}.
|
||||
|
||||
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}.
|
||||
@var{pred} is called as @code{(@var{pred} elem1 @dots{} elemN)}.
|
||||
Searching stops when the end of the shortest @var{lst} is reached.
|
||||
The return index starts from 0 for the first set of elements. If no
|
||||
set of elements pass then the return is @code{#f}.
|
||||
|
||||
@example
|
||||
(list-index odd? '(2 4 6 9)) @result{} 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue