Created
August 25, 2012 03:33
-
-
Save yihuang/3460106 to your computer and use it in GitHub Desktop.
sum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sum' :: Int -> Int | |
| sum' n = loop n 0 | |
| where | |
| loop 0 x = x | |
| loop n x = loop (n-1) (x+n) | |
| main = print $ sum' 1000000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
大哥,这个把几G的内存耗光了等了很久也没结果……
这个如何:
参照:
http://www.iteye.com/topic/366101