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

7
LINES

< > BotCompany Repo | #1024709 // oddEntries - entries of list at odd positions (counting from 0)

JavaX fragment (include)

1  
static <A> L<A> oddEntries(L<A> l) {
2  
  int n = l(l)/2;
3  
  L<A> out = emptyList(n);
4  
  for i to n:
5  
    out.add(l.get(i*2+1));
6  
  ret out;
7  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024709
Snippet name: oddEntries - entries of list at odd positions (counting from 0)
Eternal ID of this version: #1024709/3
Text MD5: a7a3fcff45456b8d9121dc700bbcdee6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-01 11:34:10
Source code size: 141 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 234 / 279
Version history: 2 change(s)
Referenced in: [show references]