

isEven :: (Integral a) => a -> Bool
isEven x = x `mod` 2 == 0

-- map to a list that only includes the even elements
onlyEvens :: (Integral a) => [a] -> [a]

onlyEvens lst = filter isEven lst

-- with an anonymous function (lambda)

onlyEvens2 lst = filter (\x -> x `mod` 2 == 0) lst


onlyEvens3 = filter (\x  -> x `mod` 2 == 0)


sumOfSquares :: [Int] -> Int
sumOfSquares lst = sum $ map (\x -> x * x) lst

sumOfSquares2 = sum
	      . map (\x -> x * x)
	      . map (+1)



mySum lst = foldl (+) 0 lst

myProd lst = foldl (*) 1 lst


join :: String -> [String] -> String
join sep strings = foldl1 (\str1 str2 -> str1 ++ sep ++ str2) strings