Created
October 1, 2015 11:14
-
-
Save motokiee/ec1815e294c6e842468f to your computer and use it in GitHub Desktop.
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
| head' :: [a] -> a | |
| head' [] = error "No Head" | |
| head' (x:_) = x | |
| head2' :: [a] -> a | |
| head2' xs = case xs of [] -> error "No Head" | |
| (x:_) -> x | |
| describeList :: [a] -> String | |
| describeList ls = "This list is" ++ case ls of [] -> " empty" | |
| [x] -> " a singleton list." | |
| xs -> " a longer list." | |
| describeList2 :: [a] -> String | |
| describeList2 ls = "The list is " ++ what ls | |
| where what [] = "empty" | |
| what [x] = "a singleton list." | |
| what xs = " a longer list." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment