Talk:Brace expansion: Difference between revisions

Line 48:
 
:: Let's take aa{,{,11}cc}22 - we expand the inner braces and get aa{,cc}22 and aa{,11cc}22. This should then expand into aa22 aacc22 aa22 and aa11cc22. It seems to me that doing otherwise violates the specification that the inner brace be expanded first. Thoughts? Thanks. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 20:39, 31 January 2014 (UTC)
 
:::The spec doesn't state that. In fact, when you've only expanded an inner brace group, you ''cannot'' give an intermediate result for the whole string yet, only a result for the "parent alternative" that the inner group belongs to. Another way to look at this, is that you (conceptually) expand the ''outer layer'' first, then separately expand each resulting alternative, and so on:
<pre style="margin-left:6em">
aa{,{,11}cc}22 -----> aa22
^^^^^^^^^^ \
`-> aa{,11}cc22 -----> aacc22
^^^^^ \
`-> aa11cc22
</pre>
:::The spec comes at it from a slightly different angle, but it evaluates to the same thing: "''The rules for parsing/expanding the whole string also apply recursively to each alternative of an alternation group''" - which, together with the given examples, should be unambiguous.
:::--[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 21:28, 31 January 2014 (UTC)
Anonymous user