Created
November 13, 2014 17:22
-
-
Save yorkie/81d37ee0c29e3f4387da to your computer and use it in GitHub Desktop.
haskell exercise
This file contains hidden or 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
import Data.Char | |
-- toUpperCase() -- | |
map isUpper "abcDEF" | |
-- compute the number of containing lower/upper chars -- | |
length (filter isLower "xxxXXXX") | |
-- will return 3 | |
length (filter isUpper "xxxXXXX") | |
-- will return 4 | |
-- choose the maximum value from a list by using `foldr` or `foldl` | |
foldr max 0 [1, 20, 3] | |
-- access like [(5,’b’),(1,’c’),(6,’a’)] returns 1 -- | |
fst (head (tail [(5,'b'),(1,'c'),(6,'a')])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GHCI