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

33
LINES

< > BotCompany Repo | #1005189 // Test Native Clauses [works]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (6971L/45K/146K).

!752

!include #1005190 // Prolog Native Stuff

sS trueStuff = [=[
  ["oops" starts with "oo"]
]=];

sS falseStuff = [=[
  ["poopoo" starts with "oopoop"]
]=];

p {
  new Prolog p;
  p.addNatives(new StartsWith, new EndsWith);
  prolog_checkTrueStuff(p, trueStuff);
  prolog_checkFalseStuff(p, falseStuff);
  print("ok!");
}

static void prolog_checkTrueStuff(Prolog p, S data) {
  for (Lisp s : p.parseStatements(data)) {
    print("Checking TRUE: " + nlUnparse(s));
    assertTrue(p.canSolve(s));
  }
}

static void prolog_checkFalseStuff(Prolog p, S data) {
  for (Lisp s : p.parseStatements(data)) {
    print("Checking FALSE: " + nlUnparse(s));
    assertFalse(p.canSolve(s));
  }
}

Author comment

Began life as a copy of #1005186

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pnmttuucjkfb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005189
Snippet name: Test Native Clauses [works]
Eternal ID of this version: #1005189/1
Text MD5: eac2bce250bb4ed150b9c5ba9d6203f0
Transpilation MD5: c76380612099e93cc699516f5157af11
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-19 19:38:10
Source code size: 719 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 394 / 418
Referenced in: [show references]