Re: [Haskell-cafe] Convert IO Int to Int

2009-06-10 Thread ptrash
Hi, I have tried on the console to write x - randomRIO(1,10) :t x Everythings fine and the type of x is x :: Integer Now I have tried to write a Method which gives me a Number of random numbers the same way but it doesn't work. randomList :: Int - [Integer] randomList 0 = [] randomList n =

Re: [Haskell-cafe] Convert IO Int to Int

2009-06-10 Thread ptrash
Hmm...I use the Eclipse Plugin. And this row is marked as error. Then where is the error? -- View this message in context: http://www.nabble.com/Convert-IO-Int-to-Int-tp23940249p23960827.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Re: [Haskell-cafe] Convert IO Int to Int

2009-06-10 Thread ptrash
Thanks a lot. I have put now everything into the main method and it works. -- View this message in context: http://www.nabble.com/Convert-IO-Int-to-Int-tp23940249p23964365.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

[Haskell-cafe] Convert IO Int to Int

2009-06-09 Thread ptrash
Hi, I am using the System.Random method randomRIO. How can I convert its output to an Int? Thanks... -- View this message in context: http://www.nabble.com/Convert-IO-Int-to-Int-tp23940249p23940249.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Re: [Haskell-cafe] Convert IO Int to Int

2009-06-09 Thread ptrash
Ok, thanks for the information. -- View this message in context: http://www.nabble.com/Convert-IO-Int-to-Int-tp23940249p23942344.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list

[Haskell-cafe] Combine to List to a new List

2009-06-09 Thread ptrash
Hi, I have the following two lists: a = [1,2,3] b = [A,B,C] I want a combination of the to lists: c = [(1,A), (2, B), (3, C)] How can I do this? I have tried c = [(x,y) | x - a, y - b] But this just returns me a list with every possible combination of the 2 lists. Thanks... -- View

Re: [Haskell-cafe] Combine to List to a new List

2009-06-09 Thread ptrash
Hey, cool. Thanks! -- View this message in context: http://www.nabble.com/Combine-to-List-to-a-new-List-tp23942440p23942633.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Convert IO Int to Int

2009-06-09 Thread ptrash
Hmm...it am not getting through it. I just want to generate a random number and then compare it with other numbers. Something like r = randomRIO (1, 10) if (r 5) then... else ... -- View this message in context: http://www.nabble.com/Convert-IO-Int-to-Int-tp23940249p23943301.html Sent from

Re: [Haskell-cafe] comprehension problem

2009-06-07 Thread ptrash
(containing [(Float, Probability)]), or Dist String (containing [(String, Probability)]) -Ross On Jun 3, 2009, at 4:01 PM, ptrash wrote: Hi, what does this to code rows mean: newtype Probability = P Float newtype Dist a = D {unD :: [(a, Probability)]} newtype definies a new type called

[Haskell-cafe] Change value of a variable

2009-06-07 Thread ptrash
Hi, how can I change the value of a variable. let x = 1 x = x + 2 First I set the value of x to 1. Then I want to increase it by 2. This way doesn't work, because I think it is a infinite expression. Is there a way to change the value? -- View this message in context:

[Haskell-cafe] Random Number

2009-06-07 Thread ptrash
Hi, is the are way (or a build in method) in haskell to get a random number from a number bottom to a number top? Something like let randomNumber = random 1 30 to get a random number between 1 and 30. -- View this message in context:

Re: [Haskell-cafe] Change value of a variable

2009-06-07 Thread ptrash
What i am exactly to do is this: I have a list of pupils (type Pupil = (Name, Grade)) where I store the name of the pupil and which grade he has. No I want to get the number (and average number) of each grade. Something like 10 Pupils have a A (23%), 2 Pupils have a B ( 4 %) etc -- View this

[Haskell-cafe] comprehension problem

2009-06-03 Thread ptrash
Hi, what does this to code rows mean: newtype Probability = P Float newtype Dist a = D {unD :: [(a, Probability)]} newtype definies a new type called Probability. But what does P Float mean? And what is the a in Dist a? What does D {...} mean? Thanks for your help. -- View this message in