Louis Wasserman wrote:
+1 on Control.Monad.Omega. In point of fact, your diagN function is simply
diagN = runOmega . mapM Omega
You'll find it an interesting exercise to grok the source of
Control.Monad.Omega, obviously, but essentially, you're replacing
concatMap with a fair (diagonal) traversal order version.
Thanks for the replies!
I've looked at Omega but it's not fair enough. The sums of the indices
are not non-decreasing:
map sum $ runOmega . mapM each $ [[1..], [1..], [1..]]
[3,4,4,4,5,5,5,5,6,6,5,6,6,7,7,5,6,7,7,8,8,6,6,7,8,8,9,9,6,7,...
Is there another way to use Omega that meets this (very important)
criterion or is Omega not the right tool here?
Thanks,
Martijn.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe