Files
C_C++
Haskell
10.hs
2.hs
3.hs
4.hs
5.hs
7.hs
dist.hs
hw.hs
operators.hs
prime.hs
test.hs
unzip.hs
zh_I.hs
zh_II.hs
Java
Misc.
Python
Vim
Webdev
git
.gitignore
Makefile
tests/Haskell/5.hs
2024-07-22 19:39:19 +02:00

32 lines
597 B
Haskell

import Data.Char (toUpper)
headInt :: [Int] -> Int
headInt (x:_) = x
tailInt :: [Int] -> [Int]
tailInt (x:xs) = xs
nullInt :: [Int] -> Bool
nullInt [] = True
nullInt _ = False
isSingleton :: [Int] -> Bool
isSingleton [x] = True
isSingleton _ = False
toUpperFirst :: [Char] -> [Char]
toUpperFirst [] = []
toUpperFirst (x:xs) = toUpper x : xs
isLetter :: Char -> Bool
isLetter x = elem x ['A'..'z']
compTest :: Char -> [Char]
compTest x = [x..'z']
mountain :: Int -> [Int]
mountain x = [1..x] ++ [x - 1, x - 2 .. 1]
divisors :: Int -> [Int]
divisors n = [d | d <- [1..n], mod n d == 0]