Open borgauf opened 1 year ago
With a session it purposefully cuts the evaluation. See L215. It shouldn't be impossible to change the code to support being able to list out all results, but the easiest for you now is to instead find all the goals of a solution.
Yes, thank you. I've got this working
child(john,sue). child(john,sam). child(jane,sue). child(jane,sam). child(sue,george). child(sue,gina). child(pete,hank). child(hank,roy).
list_children(P,L) :- findall(Child, child(Child, P), L).
: Correct to: "list_children(P,L)"? L = [john, john, jane, jane, sue, sue, pete, hank].
Now, could you help me get this into elisp? I'm trying
chlist
but it gives no output. Obviously, I'm trying to get the L list. Once I have this figured out I'll be good to go for a long while with Prolog and ob-prolog.
On Thu, Feb 16, 2023 at 3:18 AM Bjarte Johansen @.***> wrote:
With a session it purposefully cuts the evaluation. See L215 https://github.com/ljos/ob-prolog/blob/331899cfe345c934026c70b78352d320f7d8e239/ob-prolog.el#L216. It shouldn't be impossible to change the code to support being able to list out all results, but the easiest for you now is to instead to find all the goals of a solution https://www.swi-prolog.org/pldoc/man?section=allsolutions.
— Reply to this email directly, view it on GitHub https://github.com/ljos/ob-prolog/issues/24#issuecomment-1432766127, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABA73W6PSTD4AR5SZ3H3EEDWXXWG3ANCNFSM6AAAAAAUYBUTJU . You are receiving this because you authored the thread.Message ID: @.***>
-- ⨽ Lawrence Bottorff Grand Marais, MN, USA @.***
Could you enlighten us on exactly how the goal querying works? For example, I've got a query that has multiple answers, but I seem to only get the first one.
`child(john,sue). child(john,sam). child(jane,sue). child(jane,sam). child(sue,george). child(sue,gina).
male(john).
male(sam). male(george). female(june). female(sue). female(jane).
parent(Y,X) :- child(X,Y).
father(Y,X) :- child(X,Y), male(Y).
opp_sex(X,Y) :- male(X), female(Y). opp_sex(Y,X) :- male(X), female(Y).
grand_father(X,Z) :- father(X,Y), parent(Y,Z).`
`#+NAME: grandfather1
+HEADER: :session prolog-sess
+HEADER: :goal gf(X,Z)
+BEGIN_SRC prolog
gf(X,Z) :- grand_father(X,Z).
+END_SRC
+RESULTS: grandfather1
| A | = | george, | | B | = | john. |`
There should be a george, jane match too. So how do you get the SWI ";" behavior?