Skip to content

Example for reading prolog file, adding a clause and unifying #6

Description

@vasily-kartashov

I am looking for an example of how to

  • Load a Prolog script,
  • Add few more facts to the load program programmatically
  • Find a solution to a resulting predicate

In details, let say I have a script main.pl:

increment(A, B) :-
    diff(C),
    B is A + C.   

Then I'd like to enhance it on Java side

Struct.of("diff", Integer.of(15));

and then run

Struct.of("increment", Atom.of(15), Integer.of("X"));

... something that the returns the value of X as an int

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions