Libraryless. Click here for Pure Java version (17095L/124K).
!7 sclass Experiment > DynCalculatedList { LinkedHashMap<S, T3<Long>> results = new LinkedHashMap; // code -> true count, false count, error count S code; transient int timeout = 10000; transient JTextField tfCode; visualize { ret northAndCenterWithMargins( centerAndEastWithMarginInbetween( tfCode = onEnter(jLiveValueTextField_bothWays(dm_fieldLiveValue('code)), rThread evalIt), hstackWithSpacing( jbutton("Fresh", rThread { refresh(); evalIt() }), jbutton("Eval", rThread evalIt))), super.visualize()); } start { thread "Test Code" { testCode("1 == 2"); } } void refresh { veryQuickJava_refresh(); print("Refreshed translator."); } void evalIt { testCode(code); } void testCode(fS code) { fO o = evalJava_prep2(evalJava_prep(code)); setOpt(o, 'creator_class := weakRef(creator())); // Report to OS directly O result = null; pcall { result = evalWithTimeoutOrNull(timeout, func { evalJava_main2(o) }); } cleanUp(o); temp enter(); T3<Long> t = results.get(code); if (t == null) results.put(code, t = new T3(0L, 0L, 0L)); if (isTrueOpt(result)) t.a++; else if (isFalseOpt(result)) t.b++; else t.c++; changeAndUpdate(); } L<S> calc() { ret reversed(map(results, func(S key, T3<Long> value) -> S { value.a + "/" + value.b + "/" + value.c + ": " + shorten(key, 100) })); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017057 |
Snippet name: | Experiment with code fragments [Dyn Module, dev.] |
Eternal ID of this version: | #1017057/23 |
Text MD5: | 21fe95c0514916490612c3180d5d92c6 |
Transpilation MD5: | d5b4598fb6240f0ea69df9764d5e8c34 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-11 22:56:41 |
Source code size: | 1512 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 372 / 714 |
Version history: | 22 change(s) |
Referenced in: | [show references] |