ListTools[Search] - search for an occurrence of an element in a list
ListTools[SearchAll] - search for all occurrences of an element in a list
|
Calling Sequence
|
|
Search( element, L )
SearchAll( element, L )
|
|
Parameters
|
|
element
|
-
|
expression
|
L
|
-
|
list
|
|
|
|
|
Description
|
|
•
|
The Search(element, L) calling sequence searches for element in the list L. If element does not occur as an element of L, then is returned. Otherwise, the index of the first occurrence of element in L is returned.
|
|
Note: The list L is not assumed to be sorted, so the time taken by this procedure may be linear in the length of the list.
|
•
|
The SearchAll(element, L) calling sequence finds all occurrences of element in L. It returns an expression sequence of the indices of occurrences of element in L. This expression sequence is NULL if element does not occur in L.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
|
|
Download Help Document
Was this information helpful?