Skip to content

Commit

Permalink
Flatten n completion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sn6uv committed Jun 20, 2015
1 parent 591035f commit 46ba852
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mathics/builtin/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,20 @@ class Flatten(Builtin):
: Level 2 specified in {{1}, {2}} exceeds the levels, 1, which can be flattened together in {a, b}.
= Flatten[{a, b}, {{1}, {2}}, List]
## Check `n` completion
#> m = {{{1, 2}, {3}}, {{4}, {5, 6}}};
#> Flatten[m, {2}]
= {{{1, 2}, {4}}, {{3}, {5, 6}}}
#> Flatten[m, {{2}}]
= {{{1, 2}, {4}}, {{3}, {5, 6}}}
#> Flatten[m, {{2}, {1}}]
= {{{1, 2}, {4}}, {{3}, {5, 6}}}
#> Flatten[m, {{2}, {1}, {3}}]
= {{{1, 2}, {4}}, {{3}, {5, 6}}}
#> Flatten[m, {{2}, {1}, {3}, {4}}]
: Level 4 specified in {{2}, {1}, {3}, {4}} exceeds the levels, 3, which can be flattened together in {{{1, 2}, {3}}, {{4}, {5, 6}}}.
= Flatten[{{{1, 2}, {3}}, {{4}, {5, 6}}}, {{2}, {1}, {3}, {4}}, List]
## #251 tests
#> m = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
#> Flatten[m, {1}]
Expand Down

0 comments on commit 46ba852

Please sign in to comment.