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

10
LINES

< > BotCompany Repo | #1027129 // mapWithIndex

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2201L) is out of date.

static <A, B> L<B> mapWithIndex(L<A> l, IF2<Int, A, B> f) {
  L<B> out = emptyList(l);
  for i over l:
    out.add(f.get(i, l.get(i)));
  ret out;
}

static <A, B> L<B> mapWithIndex(IF2<Int, A, B> f, L<A> l) {
  ret mapWithIndex(l, f);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027129
Snippet name: mapWithIndex
Eternal ID of this version: #1027129/5
Text MD5: ccb2ed50b692c91bceed674ec2f38b08
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-15 01:09:34
Source code size: 242 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 288
Version history: 4 change(s)
Referenced in: [show references]