This file contains 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
--MALDITO PESO PINO! | |
pesoPino x = ((min x 3) * 300) + ((max 0 (x-3))*200) | |
esPesoUtil x = 400<x && x<1000 | |
sirvePino = esPesoUtil.pesoPino |
This file contains 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
--Ejercicio de: https://mumuki.io/introalgo-unc/exercises/1303-programacion-funcional-practica-listas-alguno | |
alguno :: (a -> Bool)-> [a] -> Bool | |
alguno cond list = filter cond list /= [] |
This file contains 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
-- Ejercicio: https://mumuki.io/introalgo-unc/exercises/1854-programacion-funcional-practica-listas-armarfixture | |
armarTupla p1 p2 = (p1, p2) | |
tuplasDistintas (a,b) = a /= b | |
armarFixture :: [String] -> [String] -> [(String,String)] | |
armarFixture list1 = ((filter tuplasDistintas).(zipWith armarTupla list1)) |
This file contains 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
--Ejercicio 2: Los números | |
cantidadDiasEnero = 31 | |
--Ejercicio 3: Valores y variables | |
cantidadRuedasBicicleta = 2 | |
cantidadRuedasMoto = cantidadRuedasBicicleta | |
--Ejercicio 4: Más valores |
This file contains 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
--Ejercicio 1: siguiente | |
siguiente x = x+1 | |
--Ejercicio 2: mitad | |
mitad x = x/2 | |
--Ejercicio 3: inversa | |
inversa x = (1/x) | |
--Ejercicio 4: esNumeroPositivo |
This file contains 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
--Ejercicio 4: Un poco más de inferencia | |
tipoDeXEnEsAdulta = "numero" | |
tipoDeRetornoEnEsAdulta = "booleano" | |
tipoDeXEnEsVacio = "string" | |
tipoDeRetornoEnEsVacio = "booleano" | |
--Ejercicio 6: Inferencia y composición, revisada | |
largoEsPar :: String -> Bool | |
largoEsPar = even.length |
This file contains 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
--Ejercicio 1: mitad | |
mitad :: Float -> Float | |
mitad numero = numero / 2 | |
--Ejercicio 2: esParO | |
esParO :: Int -> Bool -> Bool | |
esParO numero condicion = even numero || condicion | |
--Ejercicio 3: sumarDos | |
sumarDos :: Num a => a-> a |
This file contains 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
--Ejercicio 4: Aplicación Parcial, Parte 2 | |
dobleDelSiguiente = (*2).(+1) | |
--Ejercicio 5: Un saludo superior, Parte 1 | |
saludar nombre = "Hola " ++ nombre | |
--Ejercicio 6: Un saludo superior, parte 2 | |
saludar pref nombre = "Hola " ++ pref ++ " " ++ nombre | |
--Ejercicio 7: Un saludo superior, Parte 3 |
This file contains 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
--Ejercicio 1: esMultiploDe | |
esMultiploDe y =(==0).(rem) y | |
--Ejercicio 2: esBisiesto | |
esBisiesto :: Int -> Bool | |
esBisiesto x = (((esMultiploDe x 400)||).(esMultiploDe x 4 &&).(not.esMultiploDe x))100 | |
--Ejercicio 3: dobleDelLargo | |
dobleDelLargo = (*2).length |
This file contains 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
--Ejercicio 1: Guardas: Básico | |
minimoEntre x y | x <= y = x | |
| y <= x = y | |
--Ejercicio 2: Otherwise | |
cantidadDePochoclosParaMinutosDeCine minutos | minutos < 40 = 2 | |
| minutos > 200 = 10 | |
| otherwise = ceiling (minutos / 20) | |
--Ejercicio 3: Orden de las Condiciones |
OlderNewer