I want to write a function that generates a list of tuples containing the coordinates of an n by n grid.
For example:
> genGrid 2
[(0,0),(0,1),(1,0),(1,1)]
> genGrid 3
[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]
I know I can generate a diagonal by doing the following:
genDiagonal n = zip [0..] [0..n-1]
I am thinking there is a fairly simple way to do this, perhaps a variant of my diagonal function, but am coming up blank.