Compare commits

..

No commits in common. "0238f3ca3c9c138fa7abaaf246867eb4da89b04a" and "674da1d686cd4f90c504a0d1592adc38206e16ae" have entirely different histories.

4 changed files with 0 additions and 49 deletions

View File

@ -1,17 +0,0 @@
module Bob (responseFor) where
import Data.Char ( isSpace, isAlpha, isUpper )
isYelling :: [Char] -> Bool
isYelling stmt = any isAlpha stmt && all isUpper (filter isAlpha stmt)
isQuestion :: [Char] -> Bool
isQuestion stmt = last (filter (not . isSpace) stmt) == '?'
responseFor :: String -> String
responseFor prompt
| all isSpace prompt = "Na gut. Dann eben nicht!"
| isQuestion prompt && isYelling prompt = "Chill mal, ich bin da schon dran!"
| isQuestion prompt = "Klar."
| isYelling prompt = "Whoa, entspann dich!"
| otherwise = "Whatever."

View File

@ -1,15 +0,0 @@
module Bob (responseFor) where
import Data.Char ( isLetter, isSpace, isUpper )
responseFor :: String -> String
responseFor input
| null text = "Na gut. Dann eben nicht!"
| isShouting && isAsking = "Chill mal, ich bin da schon dran!"
| isShouting = "Whoa, entspann dich!"
| isAsking = "Klar."
| otherwise = "Whatever."
where
text = filter (not . isSpace) input
letters = filter isLetter text
isShouting = all isUpper letters && any isUpper letters
isAsking = last text == '?'

View File

@ -1,8 +0,0 @@
module Darts (score) where
score :: Float -> Float -> Int
score x y
| x^2 + y^2 <= 1 = 10
| x^2 + y^2 <= 25 = 5
| x^2 + y^2 <= 100 = 1
| otherwise = 0

View File

@ -1,9 +0,0 @@
module LeapYear (isLeapYear) where
isLeapYear :: Integer -> Bool
isLeapYear year
| year `mod` 400 == 0 = True
| year `mod` 100 == 0 = False
| year `mod` 4 == 0 = True
| otherwise = False