Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Type problem
- -- simple prime test
- prime :: Integral a => a -> Bool
- prime 1 = True
- prime n
- | n < 1 = False
- | otherwise = ptestn m0
- where
- m0 = n `div` 2
- ptestn :: Integral a => a -> Bool
- ptestn 1 = True
- ptestn m = n `mod` m > 0 && ptestn (m - 1)
- -- foo
- foo :: Integral a => a -> Bool
- foo n = n == sqr n
- where
- sqr :: Integral b => b -> b
- sqr 1 = 1
- sqr m = m*m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement