Files
functional-programming/lab4/src/Lib.hs

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