projects
/
ghc-hetmet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
[project @ 1998-08-08 19:20:33 by sof]
[ghc-hetmet.git]
/
ghc
/
tests
/
io
/
should_run
/
io012.hs
1
import IO -- 1.3
2
3
import CPUTime
4
5
main = do
6
h <- openFile "/dev/null" WriteMode
7
hPrint h (nfib 30)
8
t <- getCPUTime
9
print (length (show t)) -- printing the CPU time itself is un-cool if you want to diff the output..
10
11
nfib :: Integer -> Integer
12
nfib n
13
| n <= 1 = 1
14
| otherwise = (n1 + n2 + 1)
15
where
16
n1 = nfib (n-1)
17
n2 = nfib (n-2)