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