pub fn format_kb(kb: &KnowledgeBase) -> String
Expand description
Formats the knowledge base for display. Use for debugging.
See also print_kb().
§Note
- The keys (predicate names) are sorted.
- KnowledgeBase is a type alias. Because of this, it is not possible to implement the Display trait.
§Arguments
kb
- Knowledge Base
§Return
String
§Usage
use suiron::*;
let kb = test_kb();
let s = format_kb(&kb);
println!("{}", s);
The above will print:
_____ Contents of Knowledge Base _____ father/2 father(Alfred, Edward). father(Edward, Aethelstan). grandfather/2 grandfather($X, $Y) :- father($X, $Z), father($Z, $Y). grandfather($X, $Y) :- father($X, $Z), mother($Z, $Y). loves/2 loves(Leonard, Penny). loves(Penny, Leonard). ______________________________________