39 lines
No EOL
881 B
Haskell
39 lines
No EOL
881 B
Haskell
import Data.Char
|
|
|
|
orB :: Bool -> Bool -> Bool
|
|
orB x y = x || y
|
|
|
|
swap :: (x, y) -> (y, x)
|
|
swap (x, y) = (y, x)
|
|
|
|
middle :: [a] -> [a]
|
|
middle x = tail (take ((length x) - 1) x)
|
|
|
|
condrev :: [a] -> [a]
|
|
condrev x | (length x) >= 7 = reverse x
|
|
| otherwise = x
|
|
|
|
dblmagic :: [Int] -> [Int]
|
|
dblmagic x = filter (>10) (map (*2) x)
|
|
|
|
wtfstring :: String -> String
|
|
wtfstring x = reverse (map (toUpper) x)
|
|
|
|
addindex :: [a] -> [(Int, a)]
|
|
addindex x = zip [0..((length x) - 1)] x
|
|
|
|
relcmp :: (Num a, Ord a) => a -> a -> Bool
|
|
relcmp x y | x > y && x < (y*2) = True
|
|
| otherwise = False
|
|
|
|
third :: [a] -> a
|
|
-- third x = head (tail (tail x))
|
|
-- third x = x!!2
|
|
third (_:_:x:_) = x
|
|
|
|
safetail :: [a] -> [a]
|
|
-- safetail x = if (length x) == 0 then [] else tail x
|
|
-- safetail x | length x == 0 = []
|
|
-- | otherwise = tail x
|
|
safetail [] = []
|
|
safetail (_:xs) = xs |