Libraryless. Click here for Pure Java version (10870L/74K/247K).
!7 sS script1 = "Assert (True)."; sS script2 = "Assert (False)."; sS script = [[ Make an empty thought space X. Assert (X is empty). Add (God is good) to X. Assert (Not (X is empty)). Add (Remove (God is good)) to X. Apply always rules in X. Assert (X is empty). ]]; sS bla = [[ // concepts zivsiiacmvqrolto - True zqbbvhdeuzyhewed - False jamvyfwypzbptvle - Make an empty thought space X. matnhiruhwprdiir - Add (X) to Y. aaedrmcbfcsubkkf - Apply rule (X) to Y. bcypplfticghlkxy - Apply always rules in X. yvmxaacduvvomgqi - X is empty rzryqdohxtczvzgn - Assert (X). wynynoujiakixjus - Not (X) chjllkocfhtwcgoj - Remove (X) ]]; // head -> voidfunc(Lisp) static new HashMap<S, O> executors; static HashMap<S, ThoughtSpace> thoughtSpaces = new HashMap; p { myTruth(bla); aiStandardHandlers(); //set applyAlwaysRules_step_debug; // Assert (X). executors.put("rzryqdohxtczvzgn", voidfunc(Lisp l) { l = l.get(0); if (!isTrue(callLispEvaluator(l))) fail("Not true: " + l); }); // Make an empty thought space X. executors.put("jamvyfwypzbptvle", voidfunc(Lisp l) { S name = l.raw(0); thoughtSpaces.put(name, new ThoughtSpace(name)); }); // X is empty (thought space) lispEvaluator("yvmxaacduvvomgqi", new F1<Lisp, Bool>() { Bool get(Lisp l) { ret isEmpty(getThoughtSpace(l.raw(0)).statements); } }); // Add (X) to Y. (thought space) executors.put("matnhiruhwprdiir", voidfunc(Lisp l) { getThoughtSpace(l.raw(1)).addStatement(l.get(0)); }); // Apply rule (X) to Y. (thought space) /*executors.put("aaedrmcbfcsubkkf", voidfunc(Lisp l) { applyRule_all_ts(getThoughtSpace(l.raw(1)), l.get(0)); });*/ // Apply always rules in X. (thought space) executors.put("bcypplfticghlkxy", voidfunc(Lisp l) { thoughtSpace(getThoughtSpace(l.raw(0)); try { applyAlwaysRules(100); print("After always rules: " + struct(keys(thoughtSpace().statementsIndex))); } finally { thoughtSpace(null); } }); assertScriptSucceeds(script1); assertScriptFails(script2); assertScriptSucceeds(print(xyzToNewIDs(script))); print("OK"); } svoid assertScriptSucceeds(S script) { int i = 0; L<Lisp> lines = linesToLisp(script); for (Lisp cmd : lines) { O executor = executors.get(cmd.head); if (executor == null) fail("No executor for " + cmd); callF(executor, cmd); print("Executed line " + (++i) + " of " + l(lines)); } } svoid assertScriptFails(fS script) { assertFail_verbose(r { assertScriptSucceeds(script); }); } static ThoughtSpace getThoughtSpace(S name) { ret assertNotNull(thoughtSpaces.get(name)); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008185 |
Snippet name: | Thought space handling [WORKS] |
Eternal ID of this version: | #1008185/33 |
Text MD5: | 39938958b988f76bf718ee34481127ce |
Transpilation MD5: | 4311dfea5352f9f49a0c3dc5df357e91 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-04-29 23:17:43 |
Source code size: | 2791 bytes / 104 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 539 / 670 |
Version history: | 32 change(s) |
Referenced in: | #1008197 - Thought space handling [shortened, WORKS] |