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

7
LINES

< > BotCompany Repo | #1006857 // applyUntilStable - repeatedly apply a function to an object until the object doesn't change anymore (checking using eq)

JavaX fragment (include)

static <A> A applyUntilStable(O f, A a) {
  while true {
    A b = cast callF(f, a);
    if (eq(a, b)) ret b;
    a = b;
  }
}

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: #1006857
Snippet name: applyUntilStable - repeatedly apply a function to an object until the object doesn't change anymore (checking using eq)
Eternal ID of this version: #1006857/4
Text MD5: c9a0ec3caadb129cb4261ede928a5af1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-10 19:49:27
Source code size: 132 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 518 / 525
Version history: 3 change(s)
Referenced in: [show references]