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

!7

cmodule Spike > DynPrintLog {
  transient S program = [[
    import bool
    import or
    
    open theory rules {
      on $x say $out
        & input matches $x => say $out
    
      on $x or $y say $out
        & ((input matches $x) | (input matches $y)) => say $out
    }
    
    theory test1 {
      on hello say yo
      input hello
      expect (say yo)
    }
  ]];
  
  start-thread {
    PhilosophyBot1 bot = makeBot(input);
    bot.addFact("on hello say yo");
    bot.run();
    assertTrue(bot.hasFact("say yo"));
  }
  
  PhilosophyBot1 makeBot() {
    PhilosophyBot1 bot = new(program);
    new Var<S> input;
    
    //bot.autoOpenTheories();
    bot.onFactDo("input $x", map -> { input.set($x(map)); true; });
    bot.addNativePredicate("input matches $x", map -> match($x(map), input!));
    ret bot;
  }
}

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: 247 / 1711
Version history: 2 change(s)
Referenced in: [show references]