Haskell lets you infinitely recurse while still completing in finite time, and there’s even a function (fix) for that. Doing e.g. fix (+ 2) would be an infinite loop if evaluated, yes, but fix (2 :) would give you a useful value that’s an infinite stream of 2s. (it’s also useful for other things too)
Haskell lets you infinitely recurse while still completing in finite time, and there’s even a function (
fix
) for that. Doing e.g.fix (+ 2)
would be an infinite loop if evaluated, yes, butfix (2 :)
would give you a useful value that’s an infinite stream of 2s. (it’s also useful for other things too)