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

13
LINES

< > BotCompany Repo | #1018789 // joinIntRangesWithDistanceLessThan

JavaX fragment (include)

static L<IntRange> joinIntRangesWithDistanceLessThan(L<IntRange> l, int threshold) {
  new L<IntRange> out;
  
  for i over l: {
    IntRange r = l.get(i);
    if (i == 0 || r.start-last(out).end >= threshold)
      out.add(r);
    else
      setLast(out, intRange(last(out).start, r.end));
  }
  
  ret out;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018789
Snippet name: joinIntRangesWithDistanceLessThan
Eternal ID of this version: #1018789/1
Text MD5: 55b0d5da156b8eca31e15d047389b6d1
Author: stefan
Category: javax / math
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-13 18:39:34
Source code size: 322 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 305 / 347
Referenced in: [show references]