But if there are some beautiful arithmetics that do not use something like
state, I won't say no to them.
-邮件原件-
发件人: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 代表 Achim Schneider
发送时间: 2008年6月16日 12:01
收件人: haskell-cafe@haskell.org
主题: [Haskell-cafe] Re: How to do this in F
wikipedia.
> -邮件原件-
> 发件人: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] 代表 Achim Schneider
> 发送时间: 2008年6月16日 12:01
> 收件人: haskell-cafe@haskell.org
> 主题: [Haskell-cafe] Re: How to do this in FP way?
>
> "Magicloud Magiclouds" <[EMAIL PROTECTED]> wrot
] Re: How to do this in FP way?
"Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote:
> static int old;
> int diff (int now) { /* this would be called once a second */
> int ret = now - old;
> old = now;
> return ret;
> }
>
You do it with variables, of course.
Yes, that's it, State.
Thanks.
-邮件原件-
发件人: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 代表 Achim Schneider
发送时间: 2008年6月16日 12:01
收件人: haskell-cafe@haskell.org
主题: [Haskell-cafe] Re: How to do this in FP way?
"Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote:
> st
Thomas Davie <[EMAIL PROTECTED]> wrote:
>
> On 16 Jun 2008, at 19:24, Achim Schneider wrote:
>
> > Thomas Davie <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> On 16 Jun 2008, at 18:28, Achim Schneider wrote:
> >>
> >>> Thomas Davie <[EMAIL PROTECTED]> wrote:
> >>>
> >
> > One half of all Haske
On 16 Jun 2008, at 19:24, Achim Schneider wrote:
Thomas Davie <[EMAIL PROTECTED]> wrote:
On 16 Jun 2008, at 18:28, Achim Schneider wrote:
Thomas Davie <[EMAIL PROTECTED]> wrote:
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell,
Henning Thielemann <[EMAIL PROTECTED]> wrote:
>
> On Mon, 16 Jun 2008, Achim Schneider wrote:
>
> > We have to resort to IO actions to get the time, and to IORefs
> > because we need to chain up different calls to getCurrentTime using
> > the IO Monad. The rest of the program can work with whate
On Mon, 16 Jun 2008, Achim Schneider wrote:
We have to resort to IO actions to get the time, and to IORefs because
we need to chain up different calls to getCurrentTime using the IO
Monad. The rest of the program can work with whatever you like best.
Isn't (StateT s IO a) the cleaner altern
Thomas Davie <[EMAIL PROTECTED]> wrote:
>
> On 16 Jun 2008, at 18:28, Achim Schneider wrote:
>
> > Thomas Davie <[EMAIL PROTECTED]> wrote:
> >
> >>>
> >>> One half of all Haskell coders will tell you that mutable state
> >>> isn't a
> >>> good starting point to learn Haskell, the other half will
On 16 Jun 2008, at 18:28, Achim Schneider wrote:
Thomas Davie <[EMAIL PROTECTED]> wrote:
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell, the other half will tell you
the same because they want to be cool kids, too.
And the one l
Thomas Davie <[EMAIL PROTECTED]> wrote:
> >
> > One half of all Haskell coders will tell you that mutable state
> > isn't a
> > good starting point to learn Haskell, the other half will tell you
> > the same because they want to be cool kids, too.
>
> And the one left over will point out that h
One half of all Haskell coders will tell you that mutable state
isn't a
good starting point to learn Haskell, the other half will tell you the
same because they want to be cool kids, too.
And the one left over will point out that he asked how to do this the
FP way, not the imperative way?
"Magicloud Magiclouds" <[EMAIL PROTECTED]> wrote:
> static int old;
> int diff (int now) { /* this would be called once a second */
> int ret = now - old;
> old = now;
> return ret;
> }
>
You do it with variables, of course. This is out of some GLUT code,
using IORef's:
idle :: State -> Idl
13 matches
Mail list logo