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

39
LINES

< > BotCompany Repo | #1025761 // NL Rules in Philosophy Bot Spike [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Compilation Failed (10421L/56K).

1  
!7
2  
3  
cmodule Spike > DynPrintLog {
4  
  transient S program = [[
5  
    import bool
6  
    import or
7  
    
8  
    open theory rules {
9  
      on $x say $out
10  
        & input matches $x => say $out
11  
    
12  
      on $x or $y say $out
13  
        & ((input matches $x) | (input matches $y)) => say $out
14  
    }
15  
    
16  
    theory test1 {
17  
      on hello say yo
18  
      input hello
19  
      expect (say yo)
20  
    }
21  
  ]];
22  
  
23  
  start-thread {
24  
    PhilosophyBot1 bot = makeBot(input);
25  
    bot.addFact("on hello say yo");
26  
    bot.run();
27  
    assertTrue(bot.hasFact("say yo"));
28  
  }
29  
  
30  
  PhilosophyBot1 makeBot() {
31  
    PhilosophyBot1 bot = new(program);
32  
    new Var<S> input;
33  
    
34  
    //bot.autoOpenTheories();
35  
    bot.onFactDo("input $x", map -> { input.set($x(map)); true; });
36  
    bot.addNativePredicate("input matches $x", map -> match($x(map), input!));
37  
    ret bot;
38  
  }
39  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, wpzdwgqboxjy

No comments. add comment

Snippet ID: #1025761
Snippet name: NL Rules in Philosophy Bot Spike [dev.]
Eternal ID of this version: #1025761/3
Text MD5: ecda07ecfc39dbb6c49c53c8d1fc079f
Transpilation MD5: 0f1edac5236e691ddbc7976d9604299b
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-18 21:39:20
Source code size: 866 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 150 / 1594
Version history: 2 change(s)
Referenced in: [show references]