Proposal: Make intersperse lazier
Daniel Fischer
daniel.is.fischer at web.de
Thu Sep 16 10:39:56 EDT 2010
The current implementation of Data.List.intersperse causes a space leak
under certain not uncommon circumstances.
Trac ticket: http://hackage.haskell.org/trac/ghc/ticket/4282
The proposed implementation,
intersperse :: a -> [a] -> [a]
intersperse _ [] = []
intersperse sep (x:xs) = x : go xs
where
go [] = []
go (y:ys) = sep : y : go ys
changes the semantics from
intersperse (x : _|_) = _|_
to
intersperse (x : _|_) = x : _|_
apart from that, I think only the run-time behaviour is changed.
Period of discussion: Two weeks, until 30 Sep. 2010.
Cheers,
Daniel
More information about the Libraries
mailing list