Add List.contains to util

This commit is contained in:
Nathan McCarty 2025-01-18 16:06:00 -05:00
parent ca07f2995e
commit d343cc37a3

View file

@ -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 mapLeft f (Right x) = Right x
``` ```
## List
<!-- idris
namespace 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 ## Vectors
Define some operations for pairs of numbers, treating them roughly like vectors Define some operations for pairs of numbers, treating them roughly like vectors