Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1008947 // transpose - swap dimensions in a matrix (represented as a list of lists)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5032L/28K).

static <A> LL<A> transpose(LL<A> l) {
  new LL<A> cols;
  for i over l: {
    L<A> row = l.get(i);
    for j over row: {
      while (j >= l(cols)) cols.add(new L);
      listPut(cols.get(j), i, row.get(j));
    }
  }
  ret cols;
}

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: 441 / 569
Version history: 4 change(s)
Referenced in: [show references]