13-04-2013, 19:47
Buenas, alguno me explicaría por qué me tira error de "unexpected ;" en esa linea?
(en el Hugs dice eso, aca tira otro error en el compilador del foro, pero debe ser lo mismo)
Me lei esto
pero no me ayudo mucho.
Alguien me lo moveria a seccion academica? Lo postie aca sin querer
(en el Hugs dice eso, aca tira otro error en el compilador del foro, pero debe ser lo mismo)
Me lei esto
Spoiler: Mostrar
> fun x
> fun 2 = 34
ERROR "test.lhs" (line 2): Syntax error in input (unexpected `;')
The problem here is that the first line is incomplete. Formatting means that the symbol fun in the second line signals by layout that the construct in the first line is finished. The explicit Haskell symbol for the end of a construct is `;'; hence the message.
Another peculiarity of the system is given by
> fun x
> fun 2 = 34
which is not erroneous. It means the same as
> fun x y 2 = 34
because the second use of fun is treated as a variable!
> fun 2 = 34
ERROR "test.lhs" (line 2): Syntax error in input (unexpected `;')
The problem here is that the first line is incomplete. Formatting means that the symbol fun in the second line signals by layout that the construct in the first line is finished. The explicit Haskell symbol for the end of a construct is `;'; hence the message.
Another peculiarity of the system is given by
> fun x
> fun 2 = 34
which is not erroneous. It means the same as
> fun x y 2 = 34
because the second use of fun is treated as a variable!
--Funciones Auxiliares
esVocal :: Char -> Bool
esVocal c = c == 'a' || c == 'e'|| c == 'i'|| c == 'o'|| c == 'u'
esTropical :: String -> Bool
esTropical sabor = (length sabor > 3) && (esVocal (head sabor))
--1
esTradicional :: ((String, Int), Int, Int, Int) -> Bool
esTradicional (("chocolate", cantChocolate), cantHarina, _, _) = cantChocolate > 2 * (cantHarina)
esTradicional (("frutilla", _), _, 3, _)
esTradicional (("mascarpone", cantMascarpone), _, _, _) = (cantMascarpone >= 300) && (cantMascarpone <= 500)
--2
power :: ((String, Int), Int, Int, Int) -> Int
power (sabor, _, _, calorias) | esTropical sabor = 5
| otherwise = calorias
--3
esMasSana :: ((String, Int), Int, Int, Int) -> ((String, Int), Int, Int, Int) -> Bool
esMasSana ( _, _, harina, calorias) ( _, _, harina2, calorias2) | calorias /= calorias2 = calorias < calorias2
| otherwise = harina < harina2
Alguien me lo moveria a seccion academica? Lo postie aca sin querer