From b03822dc08da74a4815f5e5e040c85819e019775 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 24 Jul 2021 01:36:43 +0100 Subject: (Math.hs)~indenting and rearrange code for cleanliness --- Math.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Math.hs b/Math.hs index ddeac32..98c7d8c 100644 --- a/Math.hs +++ b/Math.hs @@ -1,9 +1,10 @@ module Math where - isPrime :: Int -> Bool - factors :: Int -> [Int] - intersect' :: [Int] -> [Int] -> [Int] - isPrime n = (length [ x | x <- [2..(ceiling $ sqrt $ fromIntegral 2)], - n `mod` x == 0]) == 0 - factors n = [x | x <- [1..(n `div` 2)], n `mod` x == 0] ++ [n] - intersect' a b = [x | x <- a, x `elem` b] +isPrime :: Int -> Bool +isPrime n = (length [ x | x <- [2..(ceiling $ sqrt $ fromIntegral 2)], + n `mod` x == 0]) == 0 +factors :: Int -> [Int] +factors n = [x | x <- [1..(n `div` 2)], n `mod` x == 0] ++ [n] + +intersect' :: [Int] -> [Int] -> [Int] +intersect' a b = [x | x <- a, x `elem` b] -- cgit v1.2.3-13-gbd6f