Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Filter by
Sorted by
Tagged with
Filter by Employee ID
0 votes
0 answers
54 views

I try to understand magic set transformations in datalog. All articles which I have seen provide examples for linear recursion. How can magic set transformation be applied to nonlinear recursion? For ...
Best practices
2 votes
2 replies
88 views

I have a (SWI-)Prolog program that is organized in the following way : It revolves around a core module that expose a function, let us call it query/2, that takes a query (a certain data structure, ...
0 votes
0 answers
74 views

I am trying to process a list of terms and generate a list of alternative terms from that list. I am recursing through the list and trying to generate the new term but also match against the existing ...
1 vote
1 answer
77 views

I am trying to use Prolog to query a simple relationship of "left" and "right" and the asymmetric relationship of left and right. Your left is my right and my right is your left I ...
2 votes
2 answers
189 views

I am using scryer prolog. I got this from Power of Prolog youtube channel: qes([]) --> []. qes([L|Ls]) --> qes(Ls), [L]. Using listing I got it's form in prolog clauses: ?- listing(qes/3). qes([...
1 vote
1 answer
48 views

I am following Sterling and Shapiro's "The Art of Prolog" and I came across exercise 2.3.i: Add rules defining the relations location(Course,Building), busy (Lecturer,Time), and cannot-meet ...
3 votes
2 answers
231 views

I am writing a small DCG to parse a grid of numbers. I have set it up to parse them into a list of lines, with each line being a list of numbers. I am using the library(dcg/basic) from swi-prolog to ...
1 vote
1 answer
104 views

Writing a small set of date math predicates using scryer prolog, evaluating in emacs using edi-prolog. There's a cut in the first branch of date_end_of_month below, which I intended to mean "If ...
1 vote
1 answer
113 views

It seems that the correct way to read user input in prolog is to use phrase_from_stream, providing stdin as the stream. How in Scryer Prolog does one bind a variable to the stdin stream in order to do ...
2 votes
1 answer
107 views

In this example from the reif module, C_2 takes two arguments. So what is happening here when C_2 is called with one argument? tfilter(_, [], []). tfilter(C_2, [E|Es], Fs0) :- if_(call(C_2, E), Fs0 ...
3 votes
1 answer
130 views

I am somewhat new to Prolog, having only practised for a few months so far. I am stumped on the following problem and nothing I googled seemed to help. I wrote the following code into a Prolog ...
1 vote
1 answer
186 views

I'm having trouble with a personal Prolog exercise. For context, the idea is to make a little digital logic tool which makes cell instances and pin connections. The hope is to let the program manage ...
2 votes
1 answer
246 views

I'm trying to represent the state space of a labyrinth using SWI-Prolog. The labyrinth consists of labeled rooms connected by bidirectional paths. Room 'a' is the entry point (initial state), marked ...
1 vote
1 answer
134 views

I'm developing a program in Prolog that interprets a chessboard notation. The input is a forsyth notation as a list containing pieces represented by letters, as in the example: [[t,c,b,r,d,r,b,c,t],8,...
2 votes
3 answers
160 views

Disclaimer: Yes, this is for an assignment, but I think I have an alternative solution already. I just want to figure out why this initial attempt did not work because I can't understand why it isn't ...

15 30 50 per page
1
2 3 4 5
898