Download Jar. Uses 4281K of libraries. Click here for Pure Java version (13774L/101K).
!7 !include #1001372 // direct nohupJavax for fast program starting // useful stuff to avoid transpilation please include function rpcNoArgs. concept Suggestion { S globalID = aGlobalID(); long date; S text; S author; S actionCode; } static Suggestion showing; static ReliableSingleThread rstUpdate = new(f updateImpl); static PastValueKeeper<Suggestion> past = new(3600.0); p-subst { defaultFrameTitle("Suggestion"); autoRestart(); db(); botWithInput("Suggestion Master.", [=[ me suggests hello with action [[infoBox("hello")]] ]=]); } answer { if "* suggests * with action *" { Suggestion sugg = cnew(Suggestion, date := now(), text := $2, author := $1, actionCode := $3); rstUpdate!; ret "OK, ID: " + sugg.globalID; } if "show last suggestion" { ret showLastSuggestion(); } } svoid updateImpl { final Suggestion s = highestByField(list(Suggestion), 'date); if (s != showing) { showing = s; print("Showing suggestion: " + s.text); logQuotedWithDate(javaxDataDir("suggestions.log"), "Showing: " + struct(s)); past.add(s); showSuggestion_master(s.text, r { printIndent(s.actionCode); logQuotedWithDate(javaxDataDir("suggestions.log"), "Running: " + struct(s)); optimizedJavaEval(s.actionCode); }); } } sS showLastSuggestion() { double lookback = 1.0; print('showLastSuggestion); Suggestion s = past.valueAt_orFirst(toMS(lookback)); if (s != null) { Suggestion sugg = cnew(Suggestion, date := now()); ccopyFields(s, sugg, 'text, 'author, 'actionCode); cset(sugg, copiedFrom := s.globalID); rstUpdate!; ret "OK, ID: " + sugg.globalID; } ret "Nothing there"; }
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: | #1015629 |
Snippet name: | Suggestion Master - receives and displays suggestions [OK] |
Eternal ID of this version: | #1015629/27 |
Text MD5: | e277ae502e1e5fca4d5558ac4fb60281 |
Transpilation MD5: | 5ddb0c24012ed1b1970d5ebe9720f5cb |
Author: | stefan |
Category: | javax / a.i. / gui |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-20 19:38:30 |
Source code size: | 1748 bytes / 64 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 487 / 1484 |
Version history: | 26 change(s) |
Referenced in: | #1015649 - sendToSuggestionMaster #1015659 - Suggestion Master v1 [single suggestion] |