[Haskell-beginners] should function composition operators affect memory use?

Antoine Latter aslatter at gmail.com
Sun Nov 9 02:01:34 EST 2008


On Sun, Nov 9, 2008 at 12:37 AM, Logesh Pillay <lpillay at webafrica.org.za> wrote:
> I wrote the following program a while ago :-

[snip]

>
> This compiles.  When I run it however, it exits with the stack exceeded
> message.
>
> Why?  Are the function composition operators more than syntactic sugar for
> the brackets?

Your problem is probably in this expression:

> sumFacDigits n `div` 10

Becuase function application binds tightest, this is the same as:

> div (sumFacDigitss n) 10

whereas your original was:

> sumFacDigits (div n 10)

So your transformed program is not the same as your original.

I hope that helps.

-Antoine


More information about the Beginners mailing list