fun

Add Ackermann function in Haskell

Author
Maarten 'Vngngdn' Vangeneugden
Date
Nov. 28, 2017, 2:17 p.m.
Hash
05f6801f0272f788510fc563e0196472730a75a5
Parent
5dea5c7653135e3f0055483029712b19244c172f
Modified file
ackermann.hs

ackermann.hs

6 additions and 0 deletions.

View changes Hide changes
+
1
+
2
ackermann m n
+
3
  | m == 0          = n + 1
+
4
  | m > 0 && n == 0 = ackermann (m-1) 1
+
5
  | m > 0 && n > 0  = ackermann (m-1) (ackermann m (n-1))
+
6