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

12
LINES

< > BotCompany Repo | #1033950 // countIterator_inclusive_backwards - count from a to b (inclusively)

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

Libraryless. Click here for Pure Java version (4655L/26K).

static ItIt<Int> countIterator_inclusive_backwards(int a, 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_inclusive_backwards(int a, int b, IF1<Int, A> f) {
  ret mapI_if1(f, countIterator_inclusive_backwards(a, b));
}

Author comment

Began life as a copy of #1029194

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033950
Snippet name: countIterator_inclusive_backwards - count from a to b (inclusively)
Eternal ID of this version: #1033950/1
Text MD5: a8003c394f75293205883529d4759f8b
Transpilation MD5: 83f3167a6f34da0f1a78c8f5c85f5720
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-14 22:13:48
Source code size: 352 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 59 / 92
Referenced in: [show references]