-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library interface: Unexpected result when calling run_query directly on a Machine struct #2637
Comments
What version is this? This is a problem that was solved with #2475. On current master this works as intended: use scryer_prolog::Machine;
pub fn main() -> () {
let mut machine = Machine::new_lib();
machine.load_module_string("facts", "colleague(joe, mike).".into());
let result = machine.run_query("colleague(joe, X).".into()).unwrap();
println!("{result:?}");
// Matches([QueryMatch { bindings: {"X": Atom("mike")} }])
} |
Excellent, thank you a lot! I am closing this as resolved! |
Looks like this solves the issue; working correctly my end - thanks for taking a look at it! I'm very new to the project, and Rust, but it looks like this was an issue specifically with the parser - I mentioned on IRC that I'm interested in interop with other languages, and I'm looking at using Elixir as a frontend. It's early days, but I would be even more interested in constructing/manipulating AST directly (bypassing any need to ever actually build/parse Prolog programs/queries as strings altogether), and having a Is this an avenue the internals are currently amenable to - and if not, where would be a good place to start looking, if I wanted to contribute this capability? Thanks again for the help! |
Today the following question was raised on the
#scryer
IRC channel, I file it here as an issue so that we remember it:Given the fact
colleague(joe, mike).
, when we query it withcolleague(joe, X).
, then we get asQueryResolution
:Matches([QueryMatch { bindings: {"X": String("mike")} }])
.Question: Why is
X
is bound toString("mike")
, instead of an atom?Can anyone confirm and explain this, and is more information needed here (@shawa)? Thank you a lot!
The text was updated successfully, but these errors were encountered: