Skip to main content

Questions tagged [prolog]

Prolog is the most commonly used logic programming language. It supports non-deterministic programming through backtracking and pattern matching through unification.

3 votes
0 answers
71 views

I wanted to calculate topological sort given a few predicates asserting that one element should be before another in a sequence. order(a, b) means that ...
Jakub Nowak's user avatar
3 votes
1 answer
85 views

I'm working my way through "Prolog For Artificial Intelligence" by Ivan Bratko, and exercise 3.17 is to write a maxlist(L, M) that succeeds when ...
Avrohom Yisroel's user avatar
2 votes
0 answers
369 views

Problem statement: Write a program that converts all given temperatures from a given input temperature scale to a given output temperature scale. The temperature scales to be supported are Kelvin, ...
Christian Hujer's user avatar
1 vote
1 answer
113 views

How do I refactor this mess of if/else conditions so that it's more readable? ...
pfft's user avatar
  • 19
2 votes
0 answers
48 views

I'm new in Prolog. So, I'm not sure if my code is ok and optimized. I'm also not sure if I use recursion correctly. Task: find students that has at least 1 bad grade (1 or 2) and print them in table ...
Dmitry Gashko's user avatar
6 votes
1 answer
312 views

There's a puzzle game called CrossCells (not affiliated; there's also multiple other ones with the same kind of idea, but slightly different layout and rule set) that I've been playing on and off. ...
ferada's user avatar
  • 11.4k
3 votes
0 answers
99 views

I thought it would be a good idea to take some easy to solve (by hand) problems and model them in Prolog for practice. Here is a problem I modeled in Prolog: A messy kid wrote a multiplication ...
Dair's user avatar
  • 6,220
4 votes
0 answers
287 views

To teach myself how to do meta-programming using Prolog, I've been playing around with translating ABNF syntax into DCG syntax. I'm still at the lexing and tokenising stage, but hope to advance to the ...
joeblog's user avatar
  • 243
1 vote
2 answers
151 views

Below I have some code written in prolog as a brief example. The goal of the program is to take a Computer and Information Science (CISC) course number and return any CISC prerequisites (prereqs). I ...
DanSchneiderNA's user avatar
2 votes
1 answer
535 views

In order to learn a bit more of Prolog, I implemented the echo command for SWI-Prolog. I want a correct implementation, that is, it satisfies the following ...
Christian Hujer's user avatar
5 votes
1 answer
169 views

I have some code which executes a simple task, counting the number of states reachable from a particular state, would just like some advice on how to improve it. So far it stores all the states it ...
user3667111's user avatar
4 votes
2 answers
1k views

I have attempted to a zebra puzzle in prolog and I was seeking some feedback as to the way I went about solving the puzzle. Here is the puzzle: Two weeks ago, four enthusiasts made sightings of ...
Thomas C's user avatar
2 votes
0 answers
170 views

As you can see from my predicate iterate, I am repeating Z is X-3 and Z is X-2, the scenarios are different if the value is 0 or ...
Small Legend's user avatar
4 votes
1 answer
17k views

I tried to write a program in Prolog and describe a family tree: ...
Brian Brown's user avatar
10 votes
1 answer
820 views

As an assignment for a class, I have made a small Harry Potter family tree in Prolog. It compiles into a self-contained executable that can be run straight from the command line on Linux machines. ...
Michael Brandon Morris's user avatar

15 30 50 per page