9. Count the evens

EasyProgramFree10 points

Write countEven xs, the number of elements of xs that are even. Count repeated values once for each time they occur.

Examples

  1. InputcountEven [1, 2, 3, 4, 6]Output3
  2. InputcountEven []Output0

Submitting also runs 5 hidden tests.

Solution.lean
Loading editor…

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