I have a beginner question about the SWI-Prolog C++ interface. If this is the wrong place to post such a question, I apologize and ask: Where should I ask such a question?
I want to create a predicate foo_bar/1 that binds two possible solutions to its variable. Meaning, I want the following behavior of the resulting call in prolog:
?- foo_bar(X).
X = foo ;
X = bar.
In Prolog, I'd implement it like this:
foo_bar(X) :-
X = foo;
X = bar.
Now, I'd like to implement the same behavior using the C++ interface. I tried this:
PREDICATE(foo_bar, 1) {
PL_A1 = std::string("foo").c_str();
PL_A1 = std::string("bar").c_str();
return true;
}
But it only returns the first binding:
Does the C++ interface support implementing this type of predicate? If yes, how can I do it?
Thank you very much in advance for your support!