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

!7

static S code = [=[
  
  [
    if   [$x is a $y]
    and  [a $y has a $z]
    then [$x has a $z]
  ]
  
  [ mark is a guy ]
  [ a guy has a gun ]
  
]=];

p {
  new Prolog p;
  p.showStuff = true;
  p.addTheory(code, "ad hoc");
  
  L<Lisp> l = p.rewrite();  // prints "mark has a gun"
  print(l(l) + " term(s) found.");
}

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: 642 / 678
Version history: 2 change(s)
Referenced in: #1002833 - A Thought Engine in JavaX
#3000382 - Answer for ferdie (>> t = 1, f = 0)