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

15
LINES

< > BotCompany Repo | #1005094 // dropFirstAndLast function (drop n first and n last elements of list or string, makes new ArrayList)

JavaX fragment (include)

static <A> L<A> dropFirstAndLast(int n, L<A> l) {
  ret cloneSubList(l, n, l(l)-n);
}

static <A> L<A> dropFirstAndLast(int m, int n, L<A> l) {
  ret cloneSubList(l, m, l(l)-n);
}

static <A> L<A> dropFirstAndLast(L<A> l) {
  return dropFirstAndLast(1, l);
}

static S dropFirstAndLast(S s) {
  ret substring(s, 1, l(s)-1);
}

Author comment

Began life as a copy of #1000798

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005094
Snippet name: dropFirstAndLast function (drop n first and n last elements of list or string, makes new ArrayList)
Eternal ID of this version: #1005094/5
Text MD5: 91ca9eda9d4817b7a167c837276454e4
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-12 18:09:57
Source code size: 339 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 558 / 561
Version history: 4 change(s)
Referenced in: [show references]