Jump to content

Recommended Posts

Posted (edited)

Oi, outra vez 🙂

Estava a tentar fazer mais uma função e não consegui... Desculpem incomodar.

O exercício é o seguinte:

type Hora= (Int,Int)

Assim o par (0,15) significa meia noite e um quarto.

--------------> Conventer um valor em horas (pares inteiros) para minutos (inteiro)

No sublime, coloquei:

type Hora = (Int,Int)
conv_horas_min :: Hora -> Int
conv_horas_min (a,b) = (a * 60) + b

E no terminal aparece:

rafaela@rafaela-X541UV ~/Documents/LI1 $ ghci
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude> :l h.hs
[1 of 1] Compiling Main             ( h.hs, interpreted )
Ok, modules loaded: Main.
*Main> (10,13)
(10,13)
*Main>

Obrigada...

Edited by pwseo
syntax highlight...
Posted
2 minutes ago, pwseo said:

@Rafaela Soares,

Já experimentaste aplicar a função conv_horas_min ao par que referiste? O que fizeste no terminal foi apenas introduzir o par, e o ghci devolveu-te o resultado dessa expressão (que é o próprio par, logicamente).

Socorrão, fui tão crominha!!! Esqueci-me completamente... Obrigada! 🙂

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.