Skip to main content
Filter by
Sorted by
Tagged with
Best practices
2 votes
2 replies
78 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, ...
Alphasaft's user avatar
  • 322
0 votes
0 answers
65 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 ...
Samuel Squire's user avatar
1 vote
1 answer
69 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 ...
Samuel Squire's user avatar
2 votes
2 answers
179 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([...
Zaynab Khan's user avatar
1 vote
1 answer
45 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 ...
Jeremiah John's user avatar
3 votes
2 answers
227 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 ...
Suskeyhose's user avatar
1 vote
1 answer
102 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 ...
Jake's user avatar
  • 3,100
1 vote
1 answer
107 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 ...
Jake's user avatar
  • 3,100
2 votes
1 answer
104 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 ...
user2352073's user avatar
3 votes
1 answer
129 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 ...
Ashley Ben Story's user avatar
1 vote
1 answer
184 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 ...
beeflobill's user avatar
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 ...
chrisonic's user avatar
1 vote
1 answer
133 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,...
Vitor Alves Pereira's user avatar
2 votes
3 answers
159 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 ...
aDiv's user avatar
  • 31
3 votes
1 answer
189 views

The phrase "pure monotonic Prolog" (sometimes written with a comma) is often used in discussion of the language, especially in discussion of how one ought to write code. How is the phrase ...
rotu's user avatar
  • 300

15 30 50 per page
1
2 3 4 5
898