Add List.contains to util
This commit is contained in:
parent
ca07f2995e
commit
d343cc37a3
20
src/Util.md
20
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
|
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
|
||||||
|
|
Loading…
Reference in a new issue