odds :: [a] -> [a]
odds [] = []
odds (x:xs) = x:(evens xs)
evens :: [a] -> [a]
evens [] = []
evens (_:xs) = odds(xs)
merge :: (Ord a) => [a] -> [a] -> [a]
merge [] ys = ys
merge xs [] = xs
merge (x:xs) (y:ys)
| x < y = x:(merge xs (y:ys))
| otherwise = y:(merge (x:xs) ys)
mergesort :: (Ord a) => [a] -> [a]
mergesort [] = []
mergesort [x] = [x]
mergesort xs = merge (mergesort (evens xs)) (mergesort (odds xs))
length' :: [a] -> Int
length' [] = 0
length' (x:xs) = 1 + length xs
delete' :: (Eq a) => a -> [a] -> [a]
delete' _ [] = []
delete' y (x:xs)
| y == x = delete' y xs
| otherwise = x:(delete' y xs)
sum' :: [Int] -> Int
sum' = foldl (+) 0
product' :: [Int] -> Int
product' = foldl (*) 1
length'' :: [a] -> Int
length'' = foldl (\acc _ -> 1 + acc) 0
delete'' :: (Eq a) => a -> [a] -> [a]
delete'' y = foldr (\x acc -> if x == y then acc else (x:acc)) []
reverse' :: [a] -> [a]
reverse' = foldl (\acc x -> x:acc) []