chickadee » srfi-127 » lseq-index

lseq-index pred lseq1 lseq2 ...procedure

Return the index of the leftmost element that satisfies pred.

Applies pred to successive elements of the lseqs, returning an index usable with lseq-ref if the predicate returns true. Otherwise, it iterates until one of the lseqs runs out of values, in which case #f is returned. It is an error if pred does not accept the same number of arguments as there are lseqs and return a boolean result.

The iteration stops when one of the lseqs runs out of values; in this case, lseq-index returns #f.

(lseq-index even? '(3 1 4 1 5 9))                ;=> 2
(lseq-index < '(3 1 4 1 5 9 2 5 6) '(2 7 1 8 2)) ;=> 1
(lseq-index = '(3 1 4 1 5 9 2 5 6) '(2 7 1 8 2)) ;=> #f