# [Haskell-cafe] Functional progr., images, laziness and alltherest

Jared Updike jupdike at gmail.com
Thu Jun 22 14:15:59 EDT 2006

```> > Therefore the list of non-negative integers is longer than the list of
> > positive integers. I agree they have the same cardinality but this doesn't
> > mean they have the same length.
>
> Are you saying that some of the (0,1,2,3,4,5,...), (1,2,3,4,5,...) and
> (1-1,2-1,3-1,4-1,5-1,...) lists have different lengths?

Q: Which list is longer, [0..] or [1..] ?
A: MU! (see http://en.wikipedia.org/wiki/Mu_%28negative%29 ) I am
un-asking the question. They don't have length. Length only makes
sense for lists with [] in them and infinite lists do not use [].

Jared.

P.S. If you still don't believe me, this code should put this mystery to rest:

length2 x y = f 0 0 x y where
f a b []     []      = (a, b)
f a b []     (y:ys)  = f a     (b+1) [] ys
f a b (x:xs) []      = f (a+1) b     xs []
f a b (x:xs) (y:ys)  = f (a+1) (b+1) xs ys

length2 [0..] [1..]

Feel free to get back to us with the results!
--
http://www.updike.org/~jared/
reverse ")-:"
```