4

Looking at how repeat definition is see:

repeat x = xs where xs = x : xs

What's the reason for having the local xs definition here, instead of just defining

repeat x = x : repeat x

I suspect it has something to do with compiler optimizations enabled due to better inlining, but I'm really just guessing. Does anybody know the actual reason(s)?

Frerich Raabe
  • 86,449
  • 18
  • 111
  • 204

0 Answers0