box-o-sand/lyahfgg/baby.hs

23 lines
544 B
Haskell
Raw Normal View History

doubleMe x = x + x
2012-04-03 02:35:25 +00:00
doubleUs x y = doubleMe x + doubleMe y
doubleSmallNumber x = if x > 100
then x
else x*2
doubleSmallNumber' x = (if x > 100 then x else x*2) + 1
2012-04-03 03:04:35 +00:00
boomBangs xs = [if x < 10 then "BOOM!" else "BANG!" | x <- xs, odd x]
length' xs = sum [1 | _ <- xs]
2012-04-03 03:36:30 +00:00
removeNonUppercase :: [Char] -> [Char]
2012-04-03 03:04:35 +00:00
removeNonUppercase st = [c | c <- st, c `elem` ['A'..'Z']]
2012-04-03 03:36:30 +00:00
circumference :: Float -> Float
circumference r = 2 * pi * r
circumference' :: Double -> Double
circumference' r = 2 * pi * r