Hi,

Consider the following data structure, effectively
of type [[(Int,Int)]]:

(2,5) (1,3) (2,0)
(2,5) (1,2) (1,1) (1,0)
(2,5) (3,1)
(1,5) (2,4) (2,0)
(1,5) (1,4) (1,3) (1,1) (1,0)
(1,5) (1,4) (2,2) (1,0)
(1,5) (1,4) (1,2) (2,1)
(1,5) (2,3) (1,2) (1,0)
(1,5) (2,3) (2,1)
(1,5) (1,3) (2,2) (1,1)
(1,5) (4,2)

Notice that the some of the "inner lists" start off the same.
If we delete the repetitions, we can more clearly see an
emerging structure.

(2,5) (1,3) (2,0)
      (1,2) (1,1) (1,0)
      (3,1)
(1,5) (2,4) (2,0)
      (1,4) (1,3) (1,1) (1,0)
            (2,2) (1,0)
            (1,2) (2,1)
      (2,3) (1,2) (1,0)
            (2,1)
      (1,3) (2,2) (1,1)
      (4,2)

I would like to represent this structure in Haskell, but 
am not sure quite the best way of doing it.  (I am relatively
new to Haskell.)  I think I want to do something like:

[
[(2,5),[(1,3),[(2,0)]],
       [(1,2),[(1,1),[(1,0)]]],
       [(3,1)]],
[(1,5),[(2,4),[(2,0)]],
       [(1,4),[(1,3),[(1,1),[(1,0)]]],
              [(2,2),[(1,0)]],
              [(1,2),[(2,1)]]],
       [(2,3),[(1,2),[(1,0)]],
              [(2,1)]],
       [(1,3),[(2,2),[(1,1)]]],
       [(4,2)]]
]

But what is the best way to represent this in Haskell?  (Clearly
I can't do exactly this, because Haskell requires all list elements
to be of the same type.)

Thanks,

Mark.


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

Reply via email to