Function solve

Source
pub fn solve<'a>(sn: Rc<RefCell<SolutionNode<'a>>>) -> String
Expand description

Finds one solution for the given solution node.

§Arguments

§Return

  • solution - String

§Usage

use std::rc::Rc;
use suiron::*;

let mut kb = test_kb();
let query = parse_query("loves($Who, $Whom)").unwrap();
let sn = make_base_node(Rc::new(query), &kb); // solution node

println!("{}", solve(Rc::clone(&sn)));
// Prints: $Who = Leonard, $Whom = Penny
println!("{}", solve(Rc::clone(&sn)));
// Prints: $Who = Penny, $Whom = Leonard
println!("{}", solve(Rc::clone(&sn)));
// Prints: No.