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).

1  
!752
2  
3  
!include #1005190 // Prolog Native Stuff
4  
5  
sS trueStuff = [=[
6  
  ["oops" starts with "oo"]
7  
]=];
8  
9  
sS falseStuff = [=[
10  
  ["poopoo" starts with "oopoop"]
11  
]=];
12  
13  
p {
14  
  new Prolog p;
15  
  p.addNatives(new StartsWith, new EndsWith);
16  
  prolog_checkTrueStuff(p, trueStuff);
17  
  prolog_checkFalseStuff(p, falseStuff);
18  
  print("ok!");
19  
}
20  
21  
static void prolog_checkTrueStuff(Prolog p, S data) {
22  
  for (Lisp s : p.parseStatements(data)) {
23  
    print("Checking TRUE: " + nlUnparse(s));
24  
    assertTrue(p.canSolve(s));
25  
  }
26  
}
27  
28  
static void prolog_checkFalseStuff(Prolog p, S data) {
29  
  for (Lisp s : p.parseStatements(data)) {
30  
    print("Checking FALSE: " + nlUnparse(s));
31  
    assertFalse(p.canSolve(s));
32  
  }
33  
}

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: 396 / 421
Referenced in: [show references]