[Haskell-cafe] Fair diagonals

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Fri Nov 6 04:37:06 EST 2009


Martijn van Steenbergen wrote:
> Bonus points for the following:
> * An infinite number of singleton axes produces [origin] (and
> finishes computing), e.g. forall (infinite) xs. diagN (map (:[]) xs)
> == map (:[]) xs

This can't be done - you can not produce any output before you have
checked that all the lists are not empty:

  diag (replicate n [0] ++ [[]]) == []

Bertram


More information about the Haskell-Cafe mailing list