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

23
LINES

< > BotCompany Repo | #1002832 // Test rewriting using prolog engine (OK)

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

Libraryless. Click here for Pure Java version (23310L/159K/544K).

1  
!7
2  
3  
static S code = [=[
4  
  
5  
  [
6  
    if   [$x is a $y]
7  
    and  [a $y has a $z]
8  
    then [$x has a $z]
9  
  ]
10  
  
11  
  [ mark is a guy ]
12  
  [ a guy has a gun ]
13  
  
14  
]=];
15  
16  
p {
17  
  new Prolog p;
18  
  p.showStuff = true;
19  
  p.addTheory(code, "ad hoc");
20  
  
21  
  L<Lisp> l = p.rewrite();  // prints "mark has a gun"
22  
  print(l(l) + " term(s) found.");
23  
}

Author comment

Began life as a copy of #1002830

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002832
Snippet name: Test rewriting using prolog engine (OK)
Eternal ID of this version: #1002832/3
Text MD5: bafe466fb6d7c073919524d7e025a893
Transpilation MD5: 7ac6061e9290f3c6bd79f7defbfd7cbb
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-01 22:33:33
Source code size: 348 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 643 / 680
Version history: 2 change(s)
Referenced in: [show references]