Tmp: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
[[file:///tmp]] | [[file:///tmp]] | ||
<source lang="haskell"> | |||
-- Point-free style | |||
fib :: Integer -> Integer | |||
fib = (fibs !!) | |||
where fibs = 0 : scanl (+) 1 fibs | |||
-- Explicit | |||
fib :: Integer -> Integer | |||
fib n = fibs !! n | |||
where fibs = 0 : scanl (+) 1 fibs | |||
</source> |
Revision as of 18:47, 3 February 2011
Laptop : http://www.idealo.de/preisvergleich/ProductCategory/3751F241705-795131-1339169.html
http://www.idealo.de/preisvergleich/ProductCategory/12093F920416-1344030.html?ts=1294427207827
http://www.idealo.de/preisvergleich/ProductCategory/3751F699493-1039259-1039477.html
-- Point-free style
fib :: Integer -> Integer
fib = (fibs !!)
where fibs = 0 : scanl (+) 1 fibs
-- Explicit
fib :: Integer -> Integer
fib n = fibs !! n
where fibs = 0 : scanl (+) 1 fibs