[Question]
  [
Inspired by [Create a binary wall](https://codegolf.stackexchange.com/questions/135323/create-a-binary-wall)
Given a list of positive integers, we can write them out all above each other like so, for `[2, 6, 9, 4]` as an example:
```
0010
0110
1001
0100
```
We can imagine this as a wall:
```
..#.
.##.
#..#
.#..
```
However, this is a very weak wall, and it has collapsed! Each `1` (`#`) falls down until it hits the "ground" or another `1` (`#`). The `0`s (`.`s) are present in spots left by moved `1`s.
This becomes the following:
```
....
....
.##.
####
```
Which translates back to:
```
0000
0000
0110
1111
```
Which, as a list of numbers, is `[0, 0, 6, 15]`.
# Another test case
```
[10, 17, 19, 23]
```
This becomes:
```
01010
10001
10011
10111
```
which becomes:
```
00000
10011
10011
11111
```
translating back to:
```
[0, 19, 19, 31]
```
# Challenge
Given a list of positive integers, apply this transformation to the list. Input/Output as lists of positive integers in any reasonable format. Standard loopholes apply.
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in bytes wins!
  
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 4 bytes
```
BSXB
```
Try it at [MATL Online](https://matl.io/?code=BSXB&inputs=%5B2%2C+6%2C+9%2C+4%5D&version=20.2.2)
**Explanation**
```
    % Implicitly grab input as an array 
    %   STACK: [10, 17, 19, 23]
B   % Convert each element to binary where each decimal number results in a row
    %   STACK: [0 1 0 1 0;
    %           1 0 0 0 1;
    %           1 0 0 1 1;
    %           1 0 1 1 1]
S   % Sort each column, placing all of the 1's at the bottom of each column
    %   STACK: [0 0 0 0 0;
    %           1 0 0 1 1;
    %           1 0 0 1 1;
    %           1 1 1 1 1] 
XB  % Convert each row from its binary representation to its decimal number
    %   STACK: [0, 19, 19, 31]
    % Implicitly display the result
```
[Answer]
# [Python](https://docs.python.org/), 68 bytes
```
f=lambda a:a and[x|y&a[0]for x,y in zip([0]+f(a[1:]),f(a[1:])+[-1])]
```
[Try it online!](https://tio.run/##NcgxCoAwDEDRq2SSFiu0OoiCJwkZIlIsaC3iYMW7xy4ODz4/5Ws9Yifip433eWHgsYgL3m@uGC3544TbZAgRnpBUObVXjG4kbf6osXGkSdIZ4qW8QmcNuL4YDLQdaS3yAQ "Python 3 – Try It Online")
[Answer]
## JavaScript (ES6), 50 bytes
```
f=a=>a.map(_=>a.map((e,i)=>a[a[i]|=a[--i],i]&=e))&&a
```
Explanation: Suppose two rows of the wall were like this:
```
0011
0101
```
The result needs to be this:
```
0001
0111
```
In other words, the first row becomes the AND of the two rows and the second row becomes the OR of the two rows. This just needs to be repeated enough times for all the bits to fall to the bottom.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 9 bytes
```
BUz0Ṣ€ZUḄ
```
[Try it online!](https://tio.run/##y0rNyan8/98ptMrg4c5Fj5rWRIU@3NHy////aEMDHQVDcyC21FEwMo4FAA "Jelly – Try It Online")
[Answer]
# [Python 3.5](https://docs.python.org/3/), 60 bytes
```
def f(a,*t):
 if t:b,*r=f(*t);t=f(a|b,*r);a&=b
 return(a,*t)
```
[Try it online!](https://tio.run/##JczBCoMwEATQc/MVcyqJ7KFqaTHil4iHSF0akChheyj473FLD8PAg5n9K@8ttaW8FgbbQJU4bxAZ4meq8sBWpRftcPzA9eE6zAZ5kU9O/0HhLWNFTBgbwoPQEe4TYaxvhPqpUWjayZvLnmMSq6erc@UE "Python 3 – Try It Online")
Takes input like `f(2, 6, 9, 4)`. Assumes input is non-empty. Uses a lot of [tuple unpacking](https://www.python.org/dev/peps/pep-0448/).
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 16 bytes
```
m¤z3 ®¬n qÃz mn2
```
[Try it online!](https://codepen.io/justinm53/full/NvKjZr?code=baR6MyCurG4gccN6IG1uMg==&inputs=WzIsIDYsIDksIDRd,WzEwLCAxNywgMTksIDIzXQ==&flags=LVE=) using the `-Q` flag to format the array result.
## Explanation
```
m¤z3 ®¬n qÃz mn2    Implicit: U = input array.
                        [10, 17, 19, 23]
m¤z3                Map U to binary strings and rotate the array left 90°
                         1010       0111
                        10001   ->  1011
                        10011       0001
                        10111       1000
                                     111
®¬n qÃ              Sort each binary string, putting 0s and spaces at the start
                        0111
                        0111
                        0001
                        0001
                         111
z mn2               Rotate right 90° and convert each back to a number
                         0000       0
                        10011   ->  19
                        10011       19
                        11111       31
                    Implicit output of resulting array
```
[Answer]
# Mathematica, 64 bytes
```
#~FromDigits~2&/@(Sort/@(PadLeft[#~IntegerDigits~2&/@#]))&
```
 is [`\[Transpose]`](https://reference.wolfram.com/language/ref/character/Transpose.html)
This converts the input (a list of numbers) to a list of lists of digits, pads it to be a square matrix, transposes it, sorts the rows so the 1's "fall" to the bottom, transposes back, then converts back into numbers.
[Answer]
# Octave, ~~29~~ 25 bytes
*4 bytes saved thanks to @Stewie*
```
@(x)bi2de(sort(de2bi(x)))
```
[Answer]
# [J](http://jsoftware.com/), 13 bytes
```
/:~"1&.|:&.#:
```
[Try it online!](https://tio.run/##y/r/P03B1kpB36pOyVBNr8ZKTU/ZiosrNTkjX0HDOk1TzU7BSMFMwVLBRMFawdBAwdBcwdBSwcj4/38A "J – Try It Online")
## Explanation
```
/:~"1&.|:&.#:  Input: array M
           #:  Convert each in M to binary with left-padding
       |:&     Transpose
/:~"1&         Sort each row
     &.|:      Inverse of transpose (which is just transpose)
         &.#:  Inverse of converting to binary
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
```
bí0ζR€{øC
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/6fBag3Pbgh41rak@vMP5//9oIx0FMx0FSx0Fk1gA "05AB1E – Try It Online")
Kinda different algorithm from Magic's.
[Answer]
# Dyalog APL, ~~24~~ ~~21~~ 19 bytes
```
2⊥↑{⍵[⍋⍵]}¨↓2⊥⍣¯1⊢⎕
```
[Try it online!](http://tryapl.org/?a=%7B2%u22A5%u2191%7B%u2375%5B%u234B%u2375%5D%7D%A8%u21932%u22A5%u2363%AF1%u22A2%u2375%7D10%2017%2019%2023&run) (modified so TryAPL accepts it as valid)
### How?
* `⎕` evaluated input (arrays are space separated)
* `2⊥⍣¯1⊢` converts each each of the arguments to binary (transposed of what is in the question)
* `↓` turns a 2D array into a vector of vectors
* `{⍵[⍋⍵]}¨` sorts each of the elements of the vector
* `↑` turns the vector of vectors into a 2D array again
* `2⊥` convert from binary (since it sort of transposes it, we arrive at the correct result)
[Answer]
# Dyalog APL (23 characters)
```
{2⊥¨↓⍉↑{⍵[⍋⍵]}¨↓2⊥⍣¯1⊢⍵}
```
1. Convert the input arguments into a binary matrix
2. Split the matrix into columns
3. Sort the columns into ascending order
4. Convert the sorted rows back into decimal
## Example
```
  {2⊥¨↓⍉↑{⍵[⍋⍵]}¨↓2⊥⍣¯1⊢⍵}10 17 19 23
      0 19 19 31
```
Thanks to Zacharý for correcting me on this one.
[Answer]
# JavaScript, ~~127~~ 125 bytes
```
a=>a[m='map'](_=>b[m]((n,i)=>n&&(b[i]--,d|=1<<i),d=0)&&d,b=[...Array(32)][m]((_,c)=>a[m](e=>d+=!!(2**c&e),d=0)&&d)).reverse()
```
[Try it online](https://tio.run/##TY7hSsMwFEZfJQNJ7503Ye2GMrYb8DliWNMmk441GakMRH32OiaIP78D5/Cd/NVPfRku7yrlEOcjz56NtyNXo79UDg5sOjs6gEQDsklSQmcHpxSFL673@wEp8AqlDNSx1Vq/lOI/YN2gu2sH6vEedBDZhEdeLKBZLnsZ/0REXeI1likCzrs@pymfoz7nN7C2oSfa0saRrVdUP1O9pWbtnL6dAy/YiNY@fHp9ykNqSbTfTiiljLjBI3j8x9vfAdVrqhB38w8)
*-2 bytes thanks to [Cows quack](https://codegolf.stackexchange.com/users/41805/cows-quack)*
[Answer]
## Python 2, 142 bytes
... and still golfing... hopefully –– Any help appreciated!
```
def c(l):b=[bin(n)[2:]for n in l];print[int(n,2)for n in map(''.join,zip(*map(sorted,zip(*['0'*(len(max(b,key=len))-len(x))+x for x in b]))))]
```
A big chunk of this is for padding the numbers with zeroes.
More readable:
```
def collapse(nums):
    bins = [bin(n)[2:] for n in nums]
    bins = [('0'*(len(max(bins, key = len)) - len(x))) + x for x in bins]
    print [int(n, 2) for n in map(''.join, zip(*map(sorted, zip(*bins))))]
```
This creates an array of the binary string representations, pads it, rotates it 90º clockwise, sorts each row, rotates it back 90º, and then creates integers out of each row. 
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 9 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
m¤ù yñ mÍ
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=baT5IHnxIG3N&input=WzEwLCAxNywgMTksIDIzXQ)
```
m¤ù yñ mÍ     :Implicit input of array
m             :Map
 ¤            :  To binary strings
  ù           :Left pad each with spaces to the length of the longest
    y         :Transpose
     ñ        :Sort each and transpose back
       m      :Map
        Í     :  To decimal
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 11 bytes
```
mḋTmOT0mo↔ḋ
```
[Try it online!](https://tio.run/##yygtzv7/P/fhju6QXP8Qg9z8R21TgJz///9HG@mY6VjqmMQCAA "Husk – Try It Online")
]