Download Curry: An Integrated Functional Logic Language
Transcript
A.2.23 Library List Library with some useful operations on lists. Exported functions: elemIndex :: a → [a] → Maybe Int Returns the index i of the first occurrence of an element in a list as (Just i), otherwise Nothing is returned. elemIndices :: a → [a] → [Int] Returns the list of indices of occurrences of an element in a list. find :: (a → Bool) → [a] → Maybe a Returns the first element e of a list satisfying a predicate as (Just e), otherwise Nothing is returned. findIndex :: (a → Bool) → [a] → Maybe Int Returns the index i of the first occurrences of a list element satisfying a predicate as (Just i), otherwise Nothing is returned. findIndices :: (a → Bool) → [a] → [Int] Returns the list of indices of list elements satisfying a predicate. nub :: [a] → [a] Removes all duplicates in the argument list. nubBy :: (a → a → Bool) → [a] → [a] Removes all duplicates in the argument list according to an equivalence relation. delete :: a → [a] → [a] Deletes the first occurrence of an element in a list. (\\) :: [a] → [a] → [a] Computes the difference of two lists. union :: [a] → [a] → [a] Computes the union of two lists. intersect :: [a] → [a] → [a] Computes the intersection of two lists. intersperse :: a → [a] → [a] 80