Open semaj opened 2 years ago
Hi there, sorry for the late reply!
There's currently no way to evaluate predicates in a prolog file, as my own use case was more the opposite - I needed a way to write predicates in rust for use from prolog.
You can call consult using the various methods for calling into prolog that are defined in the library. However, this will not automatically give you rust-callable functions, you'll still have to define those through the prolog!
macro.
Maybe it'd be nice to build in a consult function that also evaluates the prolog file and extracts predicate definitions. I'll have to give it some thought.
Hi, I'm in a similar situation as @semaj and just wanted to suggest implementing something similar to
int PL_initialise(int argc, char **argv)
from the SWI-Prolog C interface (see https://www.swi-prolog.org/pldoc/man?section=embedded). This would allow for a custom startup which includes loading Prolog files.
Hi @matko, thanks for your work on this. Is it possible to use this crate to evaluate the predicates in an existing
.pl
Prolog file without conversion to this crate's datatypes? I looked through the examples in this repository but did not see anything like that.