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

static IterableIterator<Int> iota(final int n) {
  ret new IterableIterator<Int>() {
    int i = 0;
    
    public bool hasNext() { ret i < n; }
    public Int next() { ret ++i; }
  };
}

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: 402 / 487
Version history: 1 change(s)
Referenced in: [show references]