Given a list of values and a function computing a key for each value, the function produces a function that finds a value
effeciently for the given key.
"""
- indexBy :: (a -> b) -> [a] -> b -> Maybe a
+ indexBy :: (a -> <e> b) -> [a] -> <e> (b -> Maybe a)
"Works like `index` but uses the given functions as hash codes and equality."
indexWith :: (a -> Integer) -> (a -> a -> Boolean) -> [(a,b)] -> a -> Maybe b
Just el2 -> el == el2
Nothing -> False
+"`elemIndex el lst` returns the index of the first element in the given list `lst` which is equal (by ==) to the query element, or Nothing if there is no such element."
+elemIndex :: a -> [a] -> Maybe Integer
+elemIndex el l = loop 0
+ where
+ len = length l
+ loop i | i < len = if el == l!i
+ then Just i
+ else loop (i+1)
+ | otherwise = Nothing
+
"""
Computes a list that contains only elements that belongs to both input lists.
"""