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

8
LINES

< > BotCompany Repo | #1015352 // iota (like in APL) - count from 1 to n (iterator)

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

Libraryless. Click here for Pure Java version (57L/1K).

1  
static IterableIterator<Int> iota(final int n) {
2  
  ret new IterableIterator<Int>() {
3  
    int i = 0;
4  
    
5  
    public bool hasNext() { ret i < n; }
6  
    public Int next() { ret ++i; }
7  
  };
8  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1015352
Snippet name: iota (like in APL) - count from 1 to n (iterator)
Eternal ID of this version: #1015352/2
Text MD5: 4b5b1c6fa09083b74801ebcf30ea875c
Transpilation MD5: 72247defeaf6834713e134aaef1e2f2c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-02 13:48:42
Source code size: 194 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 509 / 624
Version history: 1 change(s)
Referenced in: [show references]