Wolfram Kahl writes:
| [...]
|
| So I should diagonalise over that result ;-^)
|
| > test1 = diagWK (diagTP [[(x,y) | y <- [0..]] | x <- [0..]])
|
| Unfortunately even that loops.
| This is because your definition has to insist on
| finding the last element of ys before returning a first element.
|
| There is, of course, the fundamental problem in here that
| there are more infinite lists of natural numbers than fit
| even into an infinite list of lists of natural numbers.
True. That would make the reals countable, which we know they aren't.
I was worried for a while about this test running out of space:
> (head . head . diagTP) [[(x,y) | y <- [0..]] | x <- [0..]]
... until remembering that diagTP must return an empty list if its
argument contains an empty list *anywhere*, as you go on to say:
| I hope it will be sufficient to restrict argument lists for diagINF
| to contain only NONEMPTY lists.
| It may be easier to demand that all element lists are infinite.
|
| It should, however, not be relevant whether the argument list itself
| is finite or not, or should it?
As far as I can see, a lazy list of lazy lists can only be returned if
"the next member of the diagonalisation of the remaining dimensions"
is guaranteed to exist. Things which can prevent this are:
- An empty coordinate list in any dimension.
- Only finitely many dimensions with 2 or more coordinates each, e.g.
[0..] : repeat [0]
Regards,
Tom