Skip to content

Instantly share code, notes, and snippets.

@moznion
Created July 29, 2012 12:45
Show Gist options
  • Save moznion/3198488 to your computer and use it in GitHub Desktop.
Save moznion/3198488 to your computer and use it in GitHub Desktop.
スタートHaskell 2 第2回目演習 case とif を使わない
analysisLine :: String -> String
analysisLine [] = "empty"
analysisLine (_:[]) = "a character"
analysisLine xs
| last xs == '.' = "a sentence"
| ' ' `elem` xs = "some words"
| otherwise = "a word"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment