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

8
LINES

< > BotCompany Repo | #1011677 // smallestList_set

JavaX fragment (include)

// TODO: test
static O smallestList_set(O l, int i, O o) {
  if (i < 0 || i >= smallestList_l(l)) fail("Index out of bounds");
  if (l cast Pair) { if (i == 0) l.a = o; else l.b = o; ret l; }
  if (l cast T3) { if (i == 0) l.a = o; else if (i == 1) l.b = o; else l.c = o; ret l; }
  if (l cast O[]) { l[i] = o; ret l; }
  ret o;
}

Author comment

Began life as a copy of #1011512

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1011677
Snippet name: smallestList_set
Eternal ID of this version: #1011677/4
Text MD5: 7718f5c80e0b4f15bb604619a2f4eb7f
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-27 00:01:23
Source code size: 337 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 473 / 490
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)