> > Miranda has something called diagonalizing list 
> comprehensions if I recall
> > correctly. I think you would write:
> > 
> > [(a,b) // a <- [1..], b <-[1..]]
> > 
> > and the resulting list would be
> > 
> > [(1,1), (1,2), (2,1) ...]
> 
> Haskell has this too.  :) The syntax is almost the same:
> 
> [(a,b) | a <- [1..], b <- [1..]]
> 
> --FC
>

No, your Haskell code will evaluate to: [(1,1), (1,2), (1,3), ...]. Try it.
You'll never reach (2,1). Diagonalizing list comprehensions traverse the
matrix in diagonals. 

Fermin 



Reply via email to