The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [prolog]

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

7 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
41 views

Basic logic problem in Prolog

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 ...
3
votes
0answers
76 views

Writing a tokenizer in SWI-Prolog

To teach myself how to do meta-progaming 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 "...
3
votes
0answers
141 views

Movie Knowledgebase

I have had an assignment to construct a movie knowledgebase and ten specified queries in Prolog. This is my first ever Prolog program, so I would appreciate any pointers toward how I could improve. ...
3
votes
0answers
8k views

Monkey-banana problem in Prolog

The monkey-banana problem: There many variations to this problem, but the basic premise is that a monkey is in a room with a banana and a chair, and the monkey cannot reach the banana until he moves ...
2
votes
0answers
99 views

All outcomes for subtraction on each value in list individually

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 ...
2
votes
0answers
27 views

meta predicates fixedpoint/3 and fixedpointlist/3

What about the following meta-predicate "fixed point"? ...
1
vote
0answers
88 views

Echo in Prolog with single print (new version)

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 requirements: It makes only one I/O call ...