Jump to content

Talk:Brace expansion: Difference between revisions

Line 70:
::::: Regarding "''first identify the nesting, [...] and postpone expansion until all brace expansions have been identified''", you're free to do that if you feel that's the best way to solve the task in your language. In fact the Perl 6 solution does it that way: It uses a grammar to find where all the nested brace group parts are, and then passes the resulting AST tree to a recursive function which does the expansion. It's not a "requirement" though: The Perl and Python solutions both do identification and expansion in one go ''(albeit in rather different ways)''. The only requirement is that the function does the right thing; how it does it is up to you (based on what you think works best in your language).
::::: --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 22:01, 31 January 2014 (UTC)
:::::: It's scary because it's ambiguously identified. Once again: there are multiple ways of satisfying those test cases. One way requires one recursive pass to identify the relevant braces and commas and then an independent recursive pass to process them. This is certainly doable but many parsing systems are not built that way. Another approach involves suppressing duplicates. Meanwhile, given the wart-for-wart nature of the specification, it seems wrong to leave such a fundamental aspect unspecified. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 22:28, 31 January 2014 (UTC)
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.