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

15
LINES

< > BotCompany Repo | #1003099 // takeLast function (take last n elements of a list or characters of a string)

JavaX fragment (include)

1  
static <A> L<A> takeLast(L<A> l, int n) {
2  
  return newSubList(l, l(l)-n);
3  
}
4  
5  
static <A> L<A> takeLast(int n, L<A> l) {
6  
  ret takeLast(l, n);
7  
}
8  
9  
static S takeLast(int n, S s) {
10  
  ret substring(s, l(s)-n);
11  
}
12  
13  
static S takeLast(S s, int n) {
14  
  ret substring(s, l(s)-n);
15  
}

Author comment

Began life as a copy of #1000798

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003099
Snippet name: takeLast function (take last n elements of a list or characters of a string)
Eternal ID of this version: #1003099/5
Text MD5: 2fdb9f5f39282a37d6052890b67bb727
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-18 00:32:00
Source code size: 284 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 774 / 834
Version history: 4 change(s)
Referenced in: [show references]