[Haskell-beginners] Haskell code optimisation

Abhishek Kumar abhishekkmr18 at gmail.com
Fri Dec 11 14:47:47 UTC 2015


I was trying to write below program for ackerman function but it fails
(waits too long) for ack(4,1) whereas a recursive C program gives result in
37secs.Can someone pls explain this behaviour and recomend some
optimisation.

------haskell code
f m n  | m==0 =n+1
           | n==0 = f  (m-1) 1
           | otherwise = f (m-1) (f m (n-1))

Thanks
Abhishek Kumar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151211/0d1eb291/attachment.html>


More information about the Beginners mailing list