Question: How can I fix this to get the correct combinations?

Hi,

I'm trying to generate all the possible combinations of each M[i] according to the possible values for c,d and e. The code I have here generates some of them but not all - it misses out the combinations when the two or three elements in the square brackets are different ie. 

it generates
[{1}, [{1}, {1}], [{1}, {1}, {1}]]               
[{1}, [{2}, {2}], [{2}, {2}, {2}]]             
[{1}, [{3}, {3}], [{3}, {3}, {3}]] 

but not
[{1}, [{1}, {2}], [{1}, {1}, {1}]]
[{1}, [{2}, {3}], [{1}, {1}, {1}]]
[{1}, [{2}, {3}], [{1}, {2}, {1}]]
[{1}, [{2}, {3}], [{1}, {2}, {3}]]

etc.

This is because I've just defined the same c in my expressions. If I (manually) number the c's, so M[2] := [c, [d], [c, d]] --> M[2] := [c1, [d], [c2, d]];, I think I would get the right thing. However Maple then tells me there are too many elements in the list and I need to use Arrays. I can't work out how to do the same thing with Arrays. Or is there another way?

Any help greatly appreciated! Thank you 

----------------------

poss_for_v(1) := {1}, {2}, {3}:
poss_for_v(2) := {1, 2}, {2, 3}, {1, 3}:
poss_for_v(3) := {1, 2, 3}:

v_[1] := c: 
v_[2] := d: 
v_[3] := e:


M[1] := [c, [d], [e]];
M[2] := [c, [d], [c, d]];
M[3] := [c, [d], [c, c, c]];
M[4] := [c, [c, c], [e]];
M[5] := [c, [c, c], [c, d]]; 
M[6] := [c, [c, c], [c, c, c]]; 

N := [];
for c in poss_for_v(1) do  
for d in poss_for_v(2) do  
for e in poss_for_v(3) do
N := [op(N), M[6]]:
od:od:od: 
nops(N);
op(N); 

Please Wait...