Advertisement
Guest User

Untitled

a guest
Oct 12th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. isSmallPrime :: Int -> Bool
  2. isSmallPrime 2 = True
  3. isSmallPrime 3 = True
  4. isSmallPrime 5 = True
  5. isSmallPrime 7 = True
  6. isSmallPrime _ = False
  7.  
  8. equivalent :: Bool -> Bool -> Bool
  9. equivalent True True = True
  10. equivalent False False = True
  11. equivalent _ _ = False
  12.  
  13. implies :: Bool -> Bool -> Bool
  14. implies True False = False
  15. implies _ _ = True
  16.  
  17. invertO :: (Int, Int) -> (Int, Int)
  18. invertO (x,y) = (-x,-y)
  19.  
  20. isOnNegId :: (Int, Int) -> Bool
  21. isOnNegId (x,y) = (-x==y)
  22.  
  23. add :: (Int, Int) -> (Int, Int) -> (Int, Int)
  24. add (x,y) (a,b) = if y == b then (x+a,y)
  25.                         else (x*b+a*y,b*y)
  26.  
  27. multiply :: (Int, Int) -> (Int, Int) -> (Int, Int)
  28. multiply (x,y) (a,b) = (x*a, y * b)
  29.  
  30. divide :: (Int, Int) -> (Int, Int) -> (Int, Int)
  31. divide (x,y) (a,b) = (x*b,y*a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement