[Haskell-beginners] Usage of $

Mike Meyer mwm at mired.org
Sun Jun 7 20:21:26 UTC 2015


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 at 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150607/06128d27/attachment.html>


More information about the Beginners mailing list