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)

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

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: 222 / 263
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)