Skip to main content
2 votes
1 answer
151 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
83 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,090
1 vote
1 answer
82 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,090
2 votes
1 answer
96 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
112 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
144 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
233 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
108 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
148 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
2 votes
1 answer
171 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
  • 190
3 votes
0 answers
155 views

Below is my code for a shortest-path solver of the well-known sliding 15 puzzle, using CLP(FD). :- use_module(library(clpfd)). % length 35 (starting position plus 34 moves), roughly 11 CPU seconds ...
brebs's user avatar
  • 4,558
4 votes
2 answers
126 views

I'm trying to completely remove the choice points of my logical or/3 predicate that relates two logical variables and associates it with a third that can be either true or 'u' (unknown) (and when it's ...
Luiz's user avatar
  • 149
0 votes
1 answer
132 views

I'm trying to run the program but I get an error: Sandbox restriction! Could not derive which predicate may be called from call(C) expression1(A,B) combined_expression(A,B,C) solve expression1(C, J) :-...
Станислав's user avatar
4 votes
4 answers
225 views

We represent the empty tree by the atom 'nil' and the non-empty tree by the term t(X,L,R), where X denotes the root node and L and R denote the left and right subtree, respectively. As such, a ...
Dizzar's user avatar
  • 77
1 vote
2 answers
103 views

Here’s an answer to the question: To pass parameters to the Query function in the ichiban/prolog library, you can use Prolog's format/2 syntax for dynamic queries or use compound terms to safely and ...
William's user avatar
  • 31

15 30 50 per page
1
2 3 4 5
898