Another alternative to diag [[f x y | x < - xs] | y <- ys] is
to write it as diagWith f xs ys where:
diagWith f [] ys = []
diagWith f xs [] = []
diagWith f (x:xs) ys = d [x] xs ys
where
d xs' xs ys = zipWith f xs' ys ++ d' xs ys
where
d' [] [] = []
d' [] (y:ys) = d xs' [] ys
d' (x:xs) ys = d (x:xs') xs ys
The ++ could be eliminated for the price of a zipWith variant
with a continuation argument.
- diagonalisation S.M.Kahrs
- Re: diagonalisation Colin . Runciman
- Re: diagonalisation Wolfram Kahl
- Diagonalisation Wolfram Kahl
- Re: diagonalisation Wolfram Kahl
- Re: diagonalisation Tom Pledger
- Re: diagonalisation Koen Claessen
- Re: diagonalisation Wolfram Kahl
- Re: diagonalisation Ross Paterson
