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)

static void lispStandardExecutors() {
  // (X)
  lispEvaluator("mcoswmplpqlieruo", new F1<Lisp, Bool>() {
    Bool get(Lisp l) {
      ret isTrue(callLispEvaluator(l.get(0)));
    }
  });
  
  // Assert (X).
  lispExecutor("rzryqdohxtczvzgn", voidfunc(Lisp l) {
    l = l.get(0);
    if (!isTrue(callLispEvaluator(l)))
      fail("Not true: " + l);
  });
  
  // Make an empty thought space X.
  lispExecutor("jamvyfwypzbptvle", voidfunc(Lisp l) {
    S name = l.raw(0);
    addThoughtSpace(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);
    }
  });
  
  // X contains Y (thought space)
  lispEvaluator("unfiqixlxwqnomcs", new F1<Lisp, Bool>() {
    Bool get(Lisp l) {
      ret getThoughtSpace(l.raw(0)).containsStatement(l.get(1));
    }
  });
  
  // Add (X) to Y. (thought space)
  lispExecutor("matnhiruhwprdiir", voidfunc(Lisp l) {
    getThoughtSpace(l.raw(1)).addStatement(l.get(0));
  });
  
  // Apply always rules in X. (thought space)
  lispExecutor("bcypplfticghlkxy", voidfunc(Lisp l) {
    thoughtSpace(getThoughtSpace(l.raw(0));
    try {
      applyAlwaysRules(100);
      //print("After always rules: " + struct(keys(thoughtSpace().statementsIndex)));
    } finally {
      thoughtSpace(null);
    }
  });
  
  // No X where Y
  lispEvaluator(ll("bblhpfgfvcyjfwmd", "kxlzhendchftgjqh"), new F1<Lisp, Bool>() {
    Bool get(Lisp l) {
      S var = l.raw(0), newVar = aGlobalID();
      Lisp term = l.get(1);
      Lisp newTerm = lispReplaceVars(term, litmap(var, lisp(newVar)));
      //print("Evaluating negation: " + newVar + " - " + newTerm);
      new Map<S, Lisp> m;
      m.put(newVar, null);
      m = matchCondition_first(newTerm, m);
      //print("  Result: " + struct(m));
      ret m == null;
    }
  });
}

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: 376 / 403
Version history: 12 change(s)
Referenced in: [show references]