30 Nov
2002
30 Nov
'02
6:49 p.m.
Nuno Silva wrote:
I'm relatively new to haskell and have some questions:
1- I want to convert an integer to a char( if I say prelude> convert 4 ... it should return prelude> '4')
2- and vice versa?
Use chr and ord respectively, from the Char module.
3- I want to define a function that stores in a variable the following...
pretended: (Int,Int,Int,Int)
give :: IO Int give = randomRIO (0,9)
main = do k <- (give,give,give,give)
actualy this isn't possible. but can someone please tell how to do this???
main = do k1 <- give k2 <- give k3 <- give k4 <- give let k = (k1, k2, k3, k4) Or: main = do [k1, k2, k3, k4] <- sequence $ replicate 4 give let k = (k1, k2, k3, k4) -- Glynn Clements <glynn.clements@virgin.net>