Skip to content

Instantly share code, notes, and snippets.

@yorkie
Created November 13, 2014 17:22
Show Gist options
  • Save yorkie/81d37ee0c29e3f4387da to your computer and use it in GitHub Desktop.
Save yorkie/81d37ee0c29e3f4387da to your computer and use it in GitHub Desktop.
haskell exercise
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')]))
@yorkie
Copy link
Author

yorkie commented Nov 13, 2014

GHCI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment