I have a list of integers {3,4,2,2}.
This list will give patterns {x_,_,y_,y_,_,_,z_,z_,w_,w_,x_} and {0,0,0,1,1,1,1,0,0,1,1}.
Notice that I want to assign successive 0,1 with the same symbol.
How to make this?
*edit
Compare the patterns
{x_,_,y_,y_,_,_,z_,z_,w_,w_,x_}
{0, 0, 0,1, 1,1, 1,0, 0,1, 1 }
{1, _, 2,2, _,_, 3,3, 4,4, 1 }
Suppose I have symbols {x_,y_,z_,w_} (you may use {a_,b_,c_,d_,...}).
To transform lst={3,4,2,2} to {x_,_,y_,y_,_,_,z_,z_,w_,w_,x_},
begin with {x_,_,_,_,_,_,_,_,_,_,_}.
Then put y_ at positions lst[[1]] and lst[[1]]+1.
Then put z_ at positions lst[[1]]+lst[[2]] and lst[[1]]+lst[[2]]+1.
Then put w_ at positions lst[[1]]+lst[[2]]+lst[[3]] and lst[[1]]+lst[[2]]+lst[[3]]+1.
And finally put x_ at the last position.

lst = {3, 4, 2, 2}; If[OddQ[#], Table[0, {lst[[#]]}], Table[1, {lst[[#]]}]] & /@ Range[Length[lst]]which gives{{0, 0, 0}, {1, 1, 1, 1}, {0, 0}, {1, 1}}. Screen shot: !Mathematica graphics any way, that is my guess. I do not understand the pattern part though. btw, the above is not optimized, can be improved, but just wanted to say what I think what is being done. – Nasser Dec 29 '12 at 4:390is next to1, assign them with the same symbol. If0is next to0(or1is next to1), assign with_. – praaeew Dec 29 '12 at 14:54{x_,_,y_,y_,_,_,z_,z_,w_,w_,x_}? Also, how would you extend the symbol list it there were, say, 7 control integers rather than 4? – m_goldberg Dec 29 '12 at 17:49{3, 4, 1, 2}be handled? – Mr.Wizard♦ Dec 29 '12 at 18:06