[Haskell-cafe] Lazy evaluation and tail-recursion

Yves Parès limestrael at gmail.com
Wed Mar 16 18:31:00 CET 2011


A question recently popped into my mind: does lazy evaluation reduce the
need to "proper" tail-recursion?
I mean, for instance :

fmap f [] = []
fmap f (x:xs) = f x : fmap f xs

Here fmap is not tail-recursive, but thanks to the fact that operator (:) is
lazy, I think that it may still run in constant space/time, am I right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110316/521b127d/attachment.htm>

More information about the Haskell-Cafe mailing list