In 8.hs
I define
digitProduct [] = 1
digitProduct (c:rest) = (read [c] :: Int) * digitProduct rest
Then inside ghci
, I run
digitProduct $ take 10000 $ repeat '9'
And it produces a result:
-3633723290617080191
I would've imagined that a recursion of 10000 would've caused a stackoverflow. Also, my recursion isn't a tail call. What's going on here?
Nothing special is going on. 10,000 is just not enough to fill the stack. I get a stack overflow in ghci
when I replace take 10000
with take 100000000
.