9. Count the evens
Write countEven xs, the number of elements of xs that are even. Count repeated values once for each time they occur.
Examples
- Input
countEven [1, 2, 3, 4, 6]Output3 - Input
countEven []Output0
Submitting also runs 5 hidden tests.
Loading editor…
Type
\to in the editor, or click:Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.
ReadyLn 1, Col 1Lean 4
Draft saved in this browser