OK. Here it is. I want to make a monitor tool for linux. It runs for a long time, and give out a certain process's io stat per second. The way I get io stat is to read from /proc/pid/io. But the data in this file is a total, I need to read it first, then next second, read it again, and shows the difference, and go on. So, what is your idea?
-----邮件原件----- 发件人: David Roundy [mailto:[EMAIL PROTECTED] 发送时间: 2008年6月17日 1:17 收件人: Magicloud Magiclouds 抄送: haskell-cafe@haskell.org 主题: Re: [Haskell-cafe] How to do this in FP way? 2008/6/15 Magicloud Magiclouds <[EMAIL PROTECTED]>: > 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 programming. David _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe