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

7
LINES

< > BotCompany Repo | #1025010 // evenEntries - entries of list at even positions (counting from 0)

JavaX fragment (include)

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

Author comment

Began life as a copy of #1024709

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: #1025010
Snippet name: evenEntries - entries of list at even positions (counting from 0)
Eternal ID of this version: #1025010/1
Text MD5: 353eadc89bb8b86cd9aaef75e257739c
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:00
Source code size: 144 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 221 / 263
Referenced in: [show references]