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 c
gt;
> a in Dist a is a type variable, for example you could have Dist Float
> (containing [(Float, Probability)]), or Dist String (containing
> [(String, Probability)])
>
> -Ross
>
> On Jun 3, 2009, at 4:01 PM, ptrash wrote:
>
>>
>> Hi,
>>
>> wha
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:
http://www.nabble.com
Hi, thanks for the answers.
I want to make something like a counter. I have written a recursive method
which for example runs x times and counts how many times it runs, and also
count some other thinks. Add the end I want a statistic about certain thinks
returned by the method.
--
View this mess
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:
http://www.nabble.com/Random-Number-tp23914474p23914474.h
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 mes
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.
_
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@h
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..
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
Haskell-Cafe@haskel
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 th
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 =
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.
__
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.
14 matches
Mail list logo