I recently wanted to generate an infinite list of pairs

[(i,j) | i <- [1..], j <- [1..]]

Of course, this list comprehension never gets around to generating pairs (2,_). The solution I was after is easily done:

[(i,s-i) | s <- [2..], i <- [1..s-1]]

But I have a vague recollection of an alternative syntax, something like

[(i,j) \ i <- [..], j <- [1..]]

that generated a list something like [(1,1),(1,2),(2,1),(1,3),(2,2),(3,1),...]. Did I dream this, or was it a feature of Miranda*, Gopher or Hugs many years ago?


Peter


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to