aboutsummaryrefslogtreecommitdiff
path: root/Math.hs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2021-06-26 14:38:59 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2021-06-26 14:38:59 +0100
commit68d683e6e2443c5e512ab2d7cc7c006a6bb372c5 (patch)
treeac907e986f5c7a9f3ca412596ccd4b37bc951d26 /Math.hs
parent445915a8c72735e3f25cb697ce63c49890ca70f6 (diff)
downloadnumberdisplay-68d683e6e2443c5e512ab2d7cc7c006a6bb372c5.tar.gz
numberdisplay-68d683e6e2443c5e512ab2d7cc7c006a6bb372c5.tar.bz2
numberdisplay-68d683e6e2443c5e512ab2d7cc7c006a6bb372c5.zip
(Code)~rearrange definitions and code in Math module
Diffstat (limited to 'Math.hs')
-rw-r--r--Math.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/Math.hs b/Math.hs
index b1eac91..ddeac32 100644
--- a/Math.hs
+++ b/Math.hs
@@ -1,12 +1,9 @@
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 :: 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]