diff --git a/src/Util.md b/src/Util.md index 92b301a..1d46e9e 100644 --- a/src/Util.md +++ b/src/Util.md @@ -31,6 +31,26 @@ Applies a function to the contents of a `Left` if the value of the given mapLeft f (Right x) = Right x ``` +## List + + + +### contains + +Returns `True` if the list contains the given value + +```idris +export +contains : Eq a => a -> List a -> Bool +contains x [] = False +contains x (y :: xs) = + if x == y + then True + else contains x xs +``` + ## Vectors Define some operations for pairs of numbers, treating them roughly like vectors