Mercurial > hg > Members > toma > Concurrent
changeset 2:adc9ccc88192 default tip
add fib
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 30 Jul 2013 17:54:19 +0900 |
parents | e527b0150748 |
children | |
files | fib.hs |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fib.hs Tue Jul 30 17:54:19 2013 +0900 @@ -0,0 +1,14 @@ +module Main where + +import Control.Parallel + +main = a `par` b `par` c `par` d `pseq` print (a + b + c + d) + where + a = fib 35 + b = fib 36 + c = fib 37 + d = fib 38 + +fib 0 = 0 +fib 1 = 1 +fib n = fib (n-1) + fib (n-2)