Guest User

Untitled

a guest
Nov 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. listCount : (a -> Bool) -> List a -> Int
  2. listCount test list =
  3. list
  4. |> List.filter test
  5. |> List.length
  6.  
  7.  
  8. listAll : (a -> Bool) -> List a -> Bool
  9. listAll test list =
  10. let
  11. passed =
  12. list
  13. |> listCount test
  14. in
  15. passed == List.length list
  16.  
  17.  
  18. listAny : (a -> Bool) -> List a -> Bool
  19. listAny test list =
  20. let
  21. numElements =
  22. listCount test list
  23. in
  24. numElements > 0
  25.  
  26.  
  27. listNone : (a -> Bool) -> List a -> Bool
  28. listNone test list =
  29. not (listAny test list)
Add Comment
Please, Sign In to add comment