On Thu, Oct 19, 2006 at 01:37:16PM -0400, Cale Gibbard wrote: > >Why is this so? I'd have thought that the equality function for lists > >only forces evaluation of as many elements from its arguments as to > >determine the answer. > > In order to determine if [1..length xs] has an element at all, you > have to evaluate length xs, which involves forcing the entire spine of > xs, because integers can't be partially evaluated. Computing lengths > of lists is a great way to introduce strictness.
Right, so if Ints were represented as a datatype with Succ and Zero constructors (so integers could be partially evaluated), then the version with length would behave nicely on large and infinite lists :-) Best regards Tomasz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe