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

12
LINES

< > BotCompany Repo | #1018109 // countIterator_exclusive - count from a to b (exclusively)

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

Libraryless. Click here for Pure Java version (2584L/16K).

static ItIt<Int> countIterator_exclusive(int a default 0, int b) {
  ret new ItIt<Int>() {
    int i = a;
    
    public bool hasNext() { ret i < b; }
    public Int next() { ret i++; }
  };
}

static <A> ItIt<A> countIterator_exclusive(int a default 0, int b, IF1<Int, A> f) {
  ret mapI_if1(f, countIterator_exclusive(a, b));
}

Author comment

Began life as a copy of #1015352

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1018109
Snippet name: countIterator_exclusive - count from a to b (exclusively)
Eternal ID of this version: #1018109/5
Text MD5: 6852f8e4d713308bd05dd4cad8179312
Transpilation MD5: 6da63685e06d803276997f456aa277d6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-06 04:29:14
Source code size: 341 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 327 / 431
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018110 - countIterator_exclusive_step - count from a to b (exclusively) with step size
#1026590 - countIterator_inclusive - count from a to b (inclusively)
#1029194 - countIterator_exclusive_backwards - count from a to b (exclusively)