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

66
LINES

< > BotCompany Repo | #1008196 // lispStandardExecutors - also contains some evaluators

JavaX fragment (include)

1  
static void lispStandardExecutors() {
2  
  // (X)
3  
  lispEvaluator("mcoswmplpqlieruo", new F1<Lisp, Bool>() {
4  
    Bool get(Lisp l) {
5  
      ret isTrue(callLispEvaluator(l.get(0)));
6  
    }
7  
  });
8  
  
9  
  // Assert (X).
10  
  lispExecutor("rzryqdohxtczvzgn", voidfunc(Lisp l) {
11  
    l = l.get(0);
12  
    if (!isTrue(callLispEvaluator(l)))
13  
      fail("Not true: " + l);
14  
  });
15  
  
16  
  // Make an empty thought space X.
17  
  lispExecutor("jamvyfwypzbptvle", voidfunc(Lisp l) {
18  
    S name = l.raw(0);
19  
    addThoughtSpace(new ThoughtSpace(name));
20  
  });
21  
  
22  
  // X is empty (thought space)
23  
  lispEvaluator("yvmxaacduvvomgqi", new F1<Lisp, Bool>() {
24  
    Bool get(Lisp l) {
25  
      ret isEmpty(getThoughtSpace(l.raw(0)).statements);
26  
    }
27  
  });
28  
  
29  
  // X contains Y (thought space)
30  
  lispEvaluator("unfiqixlxwqnomcs", new F1<Lisp, Bool>() {
31  
    Bool get(Lisp l) {
32  
      ret getThoughtSpace(l.raw(0)).containsStatement(l.get(1));
33  
    }
34  
  });
35  
  
36  
  // Add (X) to Y. (thought space)
37  
  lispExecutor("matnhiruhwprdiir", voidfunc(Lisp l) {
38  
    getThoughtSpace(l.raw(1)).addStatement(l.get(0));
39  
  });
40  
  
41  
  // Apply always rules in X. (thought space)
42  
  lispExecutor("bcypplfticghlkxy", voidfunc(Lisp l) {
43  
    thoughtSpace(getThoughtSpace(l.raw(0));
44  
    try {
45  
      applyAlwaysRules(100);
46  
      //print("After always rules: " + struct(keys(thoughtSpace().statementsIndex)));
47  
    } finally {
48  
      thoughtSpace(null);
49  
    }
50  
  });
51  
  
52  
  // No X where Y
53  
  lispEvaluator(ll("bblhpfgfvcyjfwmd", "kxlzhendchftgjqh"), new F1<Lisp, Bool>() {
54  
    Bool get(Lisp l) {
55  
      S var = l.raw(0), newVar = aGlobalID();
56  
      Lisp term = l.get(1);
57  
      Lisp newTerm = lispReplaceVars(term, litmap(var, lisp(newVar)));
58  
      //print("Evaluating negation: " + newVar + " - " + newTerm);
59  
      new Map<S, Lisp> m;
60  
      m.put(newVar, null);
61  
      m = matchCondition_first(newTerm, m);
62  
      //print("  Result: " + struct(m));
63  
      ret m == null;
64  
    }
65  
  });
66  
}

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: #1008196
Snippet name: lispStandardExecutors - also contains some evaluators
Eternal ID of this version: #1008196/13
Text MD5: d72b8319409665c168a20a7a41cc890e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-07 00:52:47
Source code size: 1958 bytes / 66 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 479
Version history: 12 change(s)
Referenced in: [show references]