<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    with 'ghc -O2' this takes 14 seconds on my macbook pro.<br>
    <br>
    Dimitri<br>
    <br>
    <div class="moz-cite-prefix">On 12/12/15 10:35 AM, Abhishek Kumar
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAEAgXqUwYuk__jYNdJLTbi-r90QoY76DnGLqdr9up=2cqHFE4A@mail.gmail.com"
      type="cite">Compiling below code (ghc --make) still doesn't gives
      result on my i3 Ubuntu 64bit machine.Can u please elaborate
      optimisations you did?
      <div>Thanks</div>
      <div>Abhishek<br>
        <br>
        On Friday, December 11, 2015, Kim-Ee Yeoh <<a
          moz-do-not-send="true" href="mailto:ky3@atamo.com"><a class="moz-txt-link-abbreviated" href="mailto:ky3@atamo.com">ky3@atamo.com</a></a>>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">Have you tried BangPatterns? Compiled with
            optimization, I get 22 secs. Here's the full program:<br>
            <br>
            <span style="font-family:monospace,monospace">{-# LANGUAGE
              BangPatterns #-}<br>
              <br>
              f :: Int -> Int -> Int<br>
              f !m !n  <br>
                 | m==0      = n+1<br>
                 | n==0      = f (m-1) 1<br>
                 | otherwise = f (m-1) (f m (n-1))<br>
              <br>
              main = putStrLn (show (f 4 1))<br>
            </span><br>
          </div>
          <div class="gmail_extra"><br clear="all">
            <div>
              <div>-- Kim-Ee</div>
            </div>
            <br>
            <div class="gmail_quote">On Fri, Dec 11, 2015 at 9:47 PM,
              Abhishek Kumar <span dir="ltr"><<a
                  moz-do-not-send="true"
                  href="javascript:_e(%7B%7D,'cvml','abhishekkmr18@gmail.com');"
                  target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:abhishekkmr18@gmail.com">abhishekkmr18@gmail.com</a></a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">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.
                <div>
                  <div><br>
                  </div>
                  <div>------haskell code</div>
                  <div>f m n  | m==0 =n+1</div>
                  <div>           | n==0 = f  (m-1) 1</div>
                  <div>           | otherwise = f (m-1) (f m (n-1))</div>
                  <div><br>
                  </div>
                  <div>Thanks</div>
                  <span><font color="#888888">
                      <div>Abhishek Kumar</div>
                    </font></span></div>
                <br>
                _______________________________________________<br>
                Beginners mailing list<br>
                <a moz-do-not-send="true"
                  href="javascript:_e(%7B%7D,'cvml','Beginners@haskell.org');"
                  target="_blank">Beginners@haskell.org</a><br>
                <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
                <br>
              </blockquote>
            </div>
            <br>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>