Ordered list of binary sequences of multiple dimensions Given a positive integer n, output the 2^n binary sequences of length n sorted in the following precise ordering.

Test cases:

0:

0 or 1 (defining this is a matter of debate)


1:

0
1


2:

00
01
10
11


3:

000
001
010
100
011
101
110
111


4:

0000
0001
0010
0100
1000
0011
0101
1001
0110
1010
1100
0111
1011
1101
1110
1111


etc.

Additionally, the pattern of combinatorics is related to Pascal's Triangle.

0:

1 (this is given regardless of the definition given to 2^0)


1:

1
1


2:

1
2
1


3:

1
3
3
1


4:

1
4
6
4
1


etc.
Haskell, 78 bytes

import Data.List
f n=sortOn(\x-&gt;sum x:reverse(map(1-)x))$mapM id$[0,1]&lt;$[1..n]


Usage example: f 2 -> [[0,0],[0,1],[1,0],[1,1]].

How it works:

         [0,1]&lt;$[1..n]  -- make n copies of the list [0,1]
     mapM id            -- make all lists where the ith element is from the ith list.
                        -- that gives us all binary sequences
sortOn                  -- sort this list of list
    sum x               -- first by number of ones
      reverse(map(1-)x) -- then by the reversed list with bits flipped