[Haskell-cafe] Re: Fair diagonals
Martijn van Steenbergen
martijn at van.steenbergen.nl
Wed Nov 4 05:38:21 EST 2009
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..]]
Is there another way to use Omega that meets this (very important)
criterion or is Omega not the right tool here?
More information about the Haskell-Cafe