Brace expansion: Difference between revisions

m
No edit summary
Line 2,606:
</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<lang Mathematica>(*The strategy is to first capture all special sub-expressions and reformat them so they are semantically clear. The built in function Distribute could then do the work of creating the alternatives, but the order wouldn't match that given in the instructions (although as a set the alternatives would be correct). I'll take a more complicated route so as to follow the instructions exactly.*)
<lang Mathematica>
(*The strategy is to first capture all special sub-expressions and reformat them so they are semantically clear. The built in function Distribute could then do the work of creating the alternatives, but the order wouldn't match that given in the instructions (although as a set the alternatives would be correct). I'll take a more complicated route so as to follow the instructions exactly.*)
 
(*A few named constants for readability.*)
Line 2,641 ⟶ 2,640:
 
(*Data was stored in a local file.*)
BraceTestData=ReadList[FileNameJoin[{NotebookDirectory[],"BraceTestData.txt"}],String];BraceTestData//TableForm</lang>
<pre>~/{Downloads,Pictures}/*.{jpg,gif,png}
</lang>
<pre>
~/{Downloads,Pictures}/*.{jpg,gif,png}
It{{em,alic}iz,erat}e{d,}, please.
{,{,gotta have{ ,\, again\, }}more }cowbell!
{}} some }{,{\\{ edge, edge} \,}{ cases, {here} \\\\\}</pre>
</pre>
 
{{out}}
<pre>Column[Column /@ BraceExpand /@ BraceTestData, Left, 2]</pre>
<pre>
<pre>~/Downloads/*.jpg
Column[Column /@ BraceExpand /@ BraceTestData, Left, 2]
</pre>
<pre>
~/Downloads/*.jpg
~/Downloads/*.gif
~/Downloads/*.png
Line 2,678 ⟶ 2,671:
 
{}} some }{,\\ edge \,{ cases, {here} \\\\\}
{}} some }{,\\ edge \,{ cases, {here} \\\\\}</pre>
</pre>
 
=={{header|Nim}}==
1,111

edits