-
-
Save syntacticsugar/4121282 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
countZeroes :: [String] -> Int | |
countZeroes = sum . map length . map (filter (=='0')) | |
countZeroesAgain :: Show a => [a] -> Int | |
countZeroesAgain = countZeroes . map show | |
-- and for the one line, because I guess that's the challenge | |
-- btw, it's type is | |
-- cz :: Show a => [a] -> Int | |
-- which means that this function works any list of things that can be printed | |
cz = sum . map length . map (filter (=='0')) . map show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment