[Haskell-cafe] beginner's problem about lists

Neil Mitchell ndmitchell at gmail.com
Tue Oct 10 10:08:15 EDT 2006


Hi

> However this will result in a non-terminating loop for shorter [1..] [2..],
> since the first two patterns of f shall never match.

The specification of your problem makes this a guarantee. How do you
know that a list is finite? You find the [] at the end. How do you
know a list is infinite? You spend an infinite amount of time and
never find the []. Hence you can't tell if you have two big lists, or
two infinite lists.

Thanks

Neil


More information about the Haskell-Cafe mailing list