[Haskell-cafe] Maintaining laziness: another example

Martijn van Steenbergen martijn at van.steenbergen.nl
Mon Jun 8 09:01:40 EDT 2009

Jan Christiansen wrote:
> This definition is too strict. The evaluation of intersect [] [1..] 
> yields [] while the evaluation of intersect [1..] [] does not terminate. 
> This function can be improved such that it yields the empty list in both 
> cases. This function was probably not implemented by a Haskell novice ; )

Right, so unlike in append in this example the extra case for [] is 
actually desirable! Welcome to Haskell. ;-)


More information about the Haskell-Cafe mailing list