s mp $ n - 1 parses as s mp (n - 1)
s mp n - 1 parses as (s mp n) - 1

On Sun, Jun 7, 2015 at 3:09 PM, Shishir Srivastava <shishir.srivastava@gmail.com> wrote:
Hi, 

Can someone please highlight how '$' is making the difference in the execution of this function. With $ in place the function runs fine but without $ for large input values the function overflows the stack.

--------
s mp 1 = 4
s mp n = ((s mp $ n-1)^2-2) `mod` mp
--------

I cannot understand the difference between
(s mp $ n-1) and (s mp n-1)

Thanks,
Shishir Srivastava
 +44 (0) 750 127 5019



_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners