Libraryless. Click here for Pure Java version (5032L/28K).
1 | static <A> LL<A> transpose(LL<A> l) {
|
2 | new LL<A> cols; |
3 | for i over l: {
|
4 | L<A> row = l.get(i); |
5 | for j over row: {
|
6 | while (j >= l(cols)) cols.add(new L); |
7 | listPut(cols.get(j), i, row.get(j)); |
8 | } |
9 | } |
10 | ret cols; |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008947 |
| Snippet name: | transpose - swap dimensions in a matrix (represented as a list of lists) |
| Eternal ID of this version: | #1008947/5 |
| Text MD5: | 270c49af05d028f08fff444ae27bfa7d |
| Transpilation MD5: | 224be23e25d877feaab0ec5f4b64cbf8 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-02-11 20:47:29 |
| Source code size: | 241 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 719 / 893 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |