Created
April 3, 2019 23:04
-
-
Save emilianocanedo/4e708d9d0c855e41c3af840d37c1795e to your computer and use it in GitHub Desktop.
clase3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inv :: Float -> Float | |
| inv x | x /= 0 = 1/x | |
| unidades :: Integer -> Integer | |
| unidades x = mod (abs x) 10 | |
| sumaUnidades3 :: Integer -> Integer -> Integer -> Integer | |
| sumaUnidades3 x y z = unidades x + unidades y + unidades z | |
| todosImpares :: Integer -> Integer -> Integer -> Bool | |
| todosImpares x y z = mod x 2 /= 0 && mod y 2 /= 0 && mod z 2 /= 0 | |
| alMenosUnImpar :: Integer -> Integer -> Integer -> Bool | |
| alMenosUnImpar x y z | mod x 2 /= 0 = True | |
| | mod y 2 /= 0 = True | |
| | mod z 2 /= 0 = True | |
| | otherwise = False | |
| alMenosDosImpares :: Integer -> Integer -> Integer -> Bool | |
| alMenosDosImpares x y z | (mod x 2 /= 0) && (mod y 2 /= 0) = True | |
| | (mod x 2 /= 0) && (mod z 2 /= 0) = True | |
| | (mod y 2 /= 0) && (mod x 2 /= 0) = True | |
| | (mod y 2 /= 0) && (mod z 2 /= 0) = True | |
| | otherwise = False | |
| alMenosDosPares :: Integer -> Integer -> Integer -> Bool | |
| alMenosDosPares x y z | (mod x 2 == 0) && (mod y 2 == 0) = True | |
| | (mod x 2 == 0) && (mod z 2 == 0) = True | |
| | (mod y 2 == 0) && (mod x 2 == 0) = True | |
| | (mod y 2 == 0) && (mod z 2 == 0) = True | |
| | otherwise = False | |
| r1 :: Integer -> Integer -> Bool | |
| r1 x y | (mod x 2 == 0) && (mod y 2 == 0) = True | |
| | (mod x 2 /= 0) && (mod y 2 /= 0) = True | |
| | otherwise = False | |
| r2 :: Integer -> Integer -> Bool | |
| r2 a b | mod (2 * a + 3 * b) 5 == 0 = True | |
| | otherwise = False | |
| r3_aux :: Integer -> Integer -> Integer | |
| r3_aux z w | (unidades z == unidades w) = unidades w | |
| | otherwise = (-1) | |
| r3 :: Integer -> Integer -> Bool | |
| r3 z w | (unidades z /= unidades w) && (unidades z /= unidades (w*z)) && (unidades w /= unidades (w*z)) = True | |
| | otherwise = False | |
| tripleFuncion :: Integer -> Integer -> Bool | |
| tripleFuncion x y | (r1 x y ) && (r2 x y) && (r3 x y) = True | |
| | otherwise = False | |
| aux_e8 :: Integer -> Bool | |
| aux_e8 x | x < 3 = True | |
| | x >= 3 = False | |
| e8 :: Integer -> Integer -> Bool | |
| e8 x y = aux_e8 x == aux_e8 y | |
| aux_e9 :: Integer -> Integer | |
| aux_e9 x | x < 3 = 1 | |
| | (7 > x) && (x >= 3) = 2 | |
| | x >= 7 = 3 | |
| e9 :: Integer -> Integer -> Bool | |
| e9 x y = aux_e9 x == aux_e9 y | |
| e10 :: (Integer, Integer) -> (Integer, Integer) -> Bool | |
| e10 (a,b) (p,q) = (a, b) == ((div a p) * p , (div a p) * q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment