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).

1  
static ItIt<Int> countIterator_inclusive_backwards(int a, int b) {
2  
  ret new ItIt<Int>() {
3  
    int i = a;
4  
    
5  
    public bool hasNext() { ret i >= b; }
6  
    public Int next() { ret i--; }
7  
  };
8  
}
9  
10  
static <A> ItIt<A> countIterator_inclusive_backwards(int a, int b, IF1<Int, A> f) {
11  
  ret mapI_if1(f, countIterator_inclusive_backwards(a, b));
12  
}

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: 126 / 181
Referenced in: [show references]