On 13 Jul, Wolfram Kahl wrote:
> I confess guilty to have diverged from this simpler problem
>
> > (//) :: [a] -> [b] -> [(a,b)]
>
> to the more general problem
???????
like
> diagonalise:: [[a]] -> [a]
> diagonalise l = d [] l
> d [] [] = []
> d acc [] = -- d [] acc would do, but muddles the order;
> heads acc ++ d (rests acc) []
> d ls (l1:rest) = heads (ls') ++ d (rests ls') rest
> where ls' = l1: ls
> heads l = [a | (a: _) <- l]
> rests l = [as | (_: as) <- l]
?
Incidentally, are there standard names for 'heads' and 'rests' as I
have them above? I couldn't find them.
Jón
--
Jón Fairbairn [EMAIL PROTECTED]
18 Kimberley Road [EMAIL PROTECTED]
Cambridge CB4 1HH +44 1223 570179 (pm only, please)