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

12
LINES

< > BotCompany Repo | #1010208 // enumerateIntegers - returns 0, 1, -1, 2, -2, ...

JavaX fragment (include)

static IterableIterator<int> enumerateIntegers() {
  ret iteratorFromFunction(new O {
    long i = 1;
    
    Int get() {
      if (i > Integer.MAX_VALUE*2L) null;
      int result = (int) (odd(i) ? -i/2 : i/2);
      ++i;
      ret result;
    }
  });
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010208
Snippet name: enumerateIntegers - returns 0, 1, -1, 2, -2, ...
Eternal ID of this version: #1010208/4
Text MD5: 85a7c0bb8f46e82cf650e498f5373f91
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-06 20:05:33
Source code size: 266 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 414 / 458
Version history: 3 change(s)
Referenced in: [show references]