Talk:Brace expansion: Difference between revisions

(→‎Duplicate supression: still talking at "cross" purposes... :))
Line 85:
 
:::::::::::: It would be incorrect if it did so, since f and k come from different alternatives, separated by the comma before the i. Alternatives separated by comma are expanded internally and exclusively from each other—one never takes a cross product over a comma, only over braces. --[[User:TimToady|TimToady]] ([[User talk:TimToady|talk]]) 02:01, 1 February 2014 (UTC)
 
:::::::::::: The tree of nested alternation groups for that pattern is:
<pre style="margin-left:20em">
⎧c ⎫
⎪ ⎧f ⎫ ⎪
ab⎪d\,e⎩g\h⎭ ⎪qr
⎪ ⎧k ⎫ ⎪
⎪i\,j⎩l\,m⎭n⎪
⎩o\,p ⎭
</pre>
:::::::::::: Thus after recursive flattening ''(which effectively means collecting all the possibilities that you can get by going from left to right through that diagram)'', you get:
<tt style="margin-left:20em; color:#f00; display:block; background:#F9F9F9">
ab<span style="color:#191">c</span>qr<br>
ab<span style="color:#191">d\,e<span style="color:#00f">f</span></span>qr<br>
ab<span style="color:#191">d\,e<span style="color:#00f">g\h</span></span>qr<br>
ab<span style="color:#191">i\,j<span style="color:#00f">k</span>n</span>qr<br>
ab<span style="color:#191">i\,j<span style="color:#00f">l\,m</span>n</span>qr<br>
ab<span style="color:#191">o\,p</span>qr<br>
</tt>
:::::::::::: Which is exactly what the Perl solution prints. --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 02:07, 1 February 2014 (UTC)
Anonymous user