Skip to content
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

Evaluate existing prolog files #3

Open
semaj opened this issue Sep 22, 2021 · 2 comments
Open

Evaluate existing prolog files #3

semaj opened this issue Sep 22, 2021 · 2 comments

Comments

@semaj
Copy link

semaj commented Sep 22, 2021

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.

@matko
Copy link
Collaborator

matko commented Oct 4, 2021

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.

@ixolius
Copy link

ixolius commented Mar 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants