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
Hello ptrash,
Sunday, June 7, 2009, 9:41:56 PM, you wrote:
> Hi, how can I change the value of a variable.
there are no variables in haskell :)))
x, like any other identifier, is a value. when you translate to Haskell
some algo that needs to update variable contents, you may either
1) use recu
I guess the short answer is that it is not possible. 'x' is immutable
and if you want a different value than 'x' that expression has to be
given a different name like:
let x=1
y=x+2
...
But I'm not sure if that helps you. Haskell does things very
differently than the imperative languages a
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
2009/6/7 ptrash :
>
> 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
ptrash writes:
> 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.
Keep in mind that a fu
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
Sounds like a fold to me. Try looking at the doc of either foldl/r/l'
or mapAccum depending on what you want.. Then write a function for
one iteration that returns the value from that iteration combined with
the value from the last iteration
-- Jeff
On Sun, Jun 7, 2009 at 3:44 PM, ptrash wrote:
Hello ptrash,
Sunday, June 7, 2009, 11:03:55 PM, you wrote:
> 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 stat
Hello ptrash,
Sunday, June 7, 2009, 11:44:18 PM, you wrote:
> 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 ha
10 matches
Mail list logo