diff options
| author | LLLL Colonq <llll@colonq> | 2026-10-13 13:27:16 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-10-13 13:27:16 -0400 |
| commit | 22820dbea9b2db898e5f54e26ab9574784e340d8 (patch) | |
| tree | f2af5db65d05efb0c67b34d19f1b2c59664f5e93 /crates/elfmind/src/main.rs | |
| parent | c4ee47647a5bf1a06ae88ebb9410117c927868ee (diff) | |
Tweaks to datalog
Diffstat (limited to 'crates/elfmind/src/main.rs')
| -rw-r--r-- | crates/elfmind/src/main.rs | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/crates/elfmind/src/main.rs b/crates/elfmind/src/main.rs index e4cd4cc..01fd4bc 100644 --- a/crates/elfmind/src/main.rs +++ b/crates/elfmind/src/main.rs @@ -6,37 +6,46 @@ fn main() { .fact(Relation::HasItem((CharacterUnmasked::Assagioli, Item::Apple))) .fact(Relation::FriendOf((CharacterUnmasked::Bombieri, CharacterUnmasked::Cagliostro))) .learn(); - db.query().rule(Rule { - head: RelationHole::UsedItemAt(( - Hole::Val(CharacterUnmasked::Assagioli), - Hole::Var(Var(0)), - Hole::Var(Var(1)), - )), - body: vec![ - RelationHole::TimeIs(Hole::Var(Var(1))), - RelationHole::HasItem((Hole::Val(CharacterUnmasked::Assagioli), Hole::Var(Var(0)))), - ], - }).learn(); + // db.query().rule(Rule { + // head: RelationHole::UsedItemAt(( + // Hole::Val(CharacterUnmasked::Assagioli), + // Hole::Var(Var(0)), + // Hole::Var(Var(1)), + // )), + // body: vec![ + // RelationHole::TimeIs(Hole::Var(Var(1))), + // RelationHole::HasItem((Hole::Val(CharacterUnmasked::Assagioli), Hole::Var(Var(0)))), + // ], + // }).learn(); + // db.query().rule(Rule { + // head: RelationHole::FriendOf(( + // Hole::Val(CharacterUnmasked::Cagliostro), + // Hole::Var(Var(0)), + // )), + // body: vec![ + // RelationHole::TimeIs(Hole::Var(Var(1))), + // RelationHole::UsedItemAt((Hole::Var(Var(0)), Hole::Val(Item::Apple), Hole::Var(Var(1)))), + // ], + // }).learn(); + // db.query().rule(Rule { + // head: RelationHole::FriendOf(( + // Hole::Var(Var(0)), + // Hole::Var(Var(2)), + // )), + // body: vec![ + // RelationHole::FriendOf((Hole::Var(Var(0)), Hole::Var(Var(1)))), + // RelationHole::FriendOf((Hole::Var(Var(1)), Hole::Var(Var(2)))), + // ], + // }).learn(); db.query().rule(Rule { head: RelationHole::FriendOf(( - Hole::Val(CharacterUnmasked::Cagliostro), Hole::Var(Var(0)), + Hole::Var(Var(1)), )), body: vec![ - RelationHole::TimeIs(Hole::Var(Var(1))), - RelationHole::UsedItemAt((Hole::Var(Var(0)), Hole::Val(Item::Apple), Hole::Var(Var(1)))), - ], - }).learn(); - db.query().rule(Rule { - head: RelationHole::FriendOf(( - Hole::Var(Var(0)), - Hole::Var(Var(2)), - )), - body: vec![ - RelationHole::FriendOf((Hole::Var(Var(0)), Hole::Var(Var(1)))), - RelationHole::FriendOf((Hole::Var(Var(1)), Hole::Var(Var(2)))), + RelationHole::FriendOf((Hole::Var(Var(1)), Hole::Var(Var(0)))), ], }).learn(); println!("{}", db); - println!("{}", db.query().fact(Relation::TimeIs(8)).fact(Relation::TimeIs(9)).ask()); + // println!("{}", db.query().fact(Relation::TimeIs(8)).fact(Relation::TimeIs(9)).ask()); } |
