Sharedsupport / 2014-12-23-haskell.hsOpen in CoCalc
Authors: Harald Schilly, ℏal Snyder, William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
1
import Control.Parallel
2
3
main = a `par` b `par` c `pseq` print (a + b + c)
4
where
5
a = ack 3 10
6
b = fac 42
7
c = fib 34
8
9
fac 0 = 1
10
fac n = n * fac (n-1)
11
12
ack 0 n = n+1
13
ack m 0 = ack (m-1) 1
14
ack m n = ack (m-1) (ack m (n-1))
15
16
fib 0 = 0
17
fib 1 = 1
18
fib n = fib (n-1) + fib (n-2)