module Lib ( isCongruent, filterByPredicate ) where isCongruent :: Int -> Int -> Int -> Bool isCongruent a b d = a `mod` d + 1 == b `mod` d filterByPredicate :: (a -> Bool) -> [a] -> [a] filterByPredicate _ [] = [] filterByPredicate predicate (x:xs) | predicate x = x : filteredTail | otherwise = filteredTail where filteredTail = filterByPredicate predicate xs