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

14
LINES

< > BotCompany Repo | #1027958 // indicesOfPred

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

Transpiled version (9944L) is out of date.

static <A> L<Int> lambdaMapLike indicesOfPred(IPred<A> f, L<A> l) {
  if (l == null) null;
  
  new L<Int> x;
  int n = l(l);
  for i to n:
    if (f.get(l.get(i)))
      x.add(i);
  ret x;
}

static <A> L<Int> indicesOfPred(L<A> l, IPred<A> f) {
  ret indicesOfPred(f, l);
}

Author comment

Began life as a copy of #1025514

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027958
Snippet name: indicesOfPred
Eternal ID of this version: #1027958/9
Text MD5: 535ff71ae4a5b825de922abf1dbf19ec
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-01-16 15:39:08
Source code size: 284 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 123 / 218
Version history: 8 change(s)
Referenced in: [show references]