/Prelude-v22.0.0/Bool/even.dhall
Copy path to clipboardReturns True
if there are an even number of False
elements in the list and
returns False
otherwise.
This function is the Monoid
for the ==
operation.
Examples
even [ False, True, False ] ≡ True
even [ False, True ] ≡ False
even [ False ] ≡ False
even ([] : List Bool) ≡ True
Source
{-|
Returns `True` if there are an even number of `False` elements in the list and
returns `False` otherwise.
This function is the `Monoid` for the `==` operation.
-}
let even
: List Bool → Bool
= λ(xs : List Bool) →
List/fold Bool xs Bool (λ(x : Bool) → λ(y : Bool) → x == y) True
let example0 = assert : even [ False, True, False ] ≡ True
let example1 = assert : even [ False, True ] ≡ False
let example2 = assert : even [ False ] ≡ False
let example3 = assert : even ([] : List Bool) ≡ True
in even