[Haskell-cafe] How to do this in FP way?

David Roundy daveroundy at gmail.com
Mon Jun 16 13:17:02 EDT 2008

2008/6/15 Magicloud Magiclouds <magicloud.magiclouds at gmail.com>:
> Hello,
>     I am getting familiar with FP now, and I have a "program design" kind of
> question.
>     Say I have something like this in C:
> static int old;
> int diff (int now) { /* this would be called once a second */
>   int ret = now - old;
>   old = now;
>   return ret;
> }
>     Because there is no "variable" in Haskell. So how to do this in a FP
> way?

A better question would be to think about what you are trying to
accomplish, and then ask how to achieve that through functional


More information about the Haskell-Cafe mailing list