
10 Dec
2004
10 Dec
'04
1:53 p.m.
Thanks to all for the good info. I see what tail recursion is now. Robert's example above leads me to a couple questions: I had actually written my countlines like Robert's before the other one I mailed in and mine overflowed the stack just like his. According to people's responses, this one really is tail recursive, isn't it? If so why does it not get flattened out? countlines = aux 0 where aux x [] = x aux x (_:ls) = aux (x+1) ls countlines' = aux 0 where aux x [] = x aux x (_:ls) | x `seq` False = undefined | otherwise = aux (x+1) ls Lastly, I've not seen the seq operator shown here in Robert's countlines' before. What does it do?