ZVON > References > Haskell reference |
Intro / Search / ZVON |
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | >> List << | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random |
Module: | List |
---|---|
Function: | elemIndex |
Type: | Eq => a -> [a] -> Maybe Int |
Description: | returns the index of the first occurrence, if any, of value in list. |
Related: | elemIndices, find, findIndex, findIndices |
Input: elemIndex 2 [1,2,3,4,5]
Output: Just 1
Input: elemIndex 2 [2,2,2,3,3,3,4,4,4]
Output: Just 0
Input: elemIndex 10 [1,2,3,4,5]
Output: Nothing
Input: elemIndex 'f' "abcdefghi"
Output: Just 5