Questions tagged as 'prolog'

2
answers

Family Tree Exercise

I have to create a relationship of uncle according to the genealogy tree below: I already have the following code: mãe(ana, eva). mãe(eva, noé). mãe(bia, raí). mãe(bia, clô). mãe(bia, ary). mãe(lia, gal). pai(ivo, eva). pai(raí, noé). pai(...
asked by 14.08.2014 / 14:06
1
answer

Logic error?

I have the following code: mãe(ana, eva). mãe(eva, noé). mãe(bia, raí). mãe(bia, clô). mãe(bia, ary). mãe(lia, gal). pai(ivo, eva). pai(raí, noé). pai(gil, raí). pai(gil, clô). pai(gil, ary). pai(ary, gal). avô(X, Y) :- pai(X, Z), pai(Z, Y); p...
asked by 12.08.2014 / 14:07
1
answer

How to check which items in the list meet a certain condition?

How to make a function called LinhasLongas , which receives 2 parameters at least, to decide if a bus line is long or not? The data is in a list of punctuated pairs, such as: ((1 . 2)(2 . 3)(5 . 3)(2 . 7)(10 . 20)) Line number in t...
asked by 18.06.2015 / 00:11
1
answer

Going from one point to another

With the following facts, x(p1,d1,c,d,e,f), y(d1,d2,i,j,k,l), z(d2,d3,o,p,q,r), Think of them as points, I would like to know how I can go from x to z, by inputting p1 and d3. I have, for example: write('Partida: '),nl, read(Partida_it...
asked by 15.05.2015 / 22:49
1
answer

How can I compile a simple prolog program?

I have SWI-Prolog installed, but I'm using it as a kind of interpreter, exp: swi-pl?- [load]. True I would like to know if there is a simple command that I can use via terminal to compile the source code into an executable.     
asked by 23.08.2016 / 21:28
0
answers

Semantic representation of passive sentences

Does anyone know how to do (in Prolog) the semantic representation of a sentence like:    Pedro was kissed by Ana. ... so that the semantic representation is the same as the active voice:    Ana kissed Pedro.     
asked by 27.05.2016 / 13:26
1
answer

How to make communication between java in prolog?

Good morning! I need to develop a specialist system like college work. I thought about doing it using java to create the interface and prolog as an inference engine and fact base. But the links I found about a JPL library are broken and I do...
asked by 16.07.2016 / 15:43
1
answer

How to browse a list in Prolog to find a specific item

I'm a beginner in Prolog and I have questions about how to go through a list. I have a historico(ra,[i1,i2,i3,...,in]) predicate where ra is the Academic Record of a student and each i is an item, with the form item(CM...
asked by 23.06.2015 / 04:21
1
answer

What is a singleton variable in prolog?

I'm doing a job in Prolog and when trying to make a query it says there are "Singleton variables". For example, a part of the code: s([Policia_X, Policia_Y, Ladrao_X, Ladrao_Y]) :- pode_andar_horizontal([Policia_X, Policia_Y]). Returns the...
asked by 25.10.2018 / 03:00
1
answer

Reading files in PROLOG

How can I read in PROLOG a .txt file like this: iago.neves pedro.santos joao.vitor larissa.figueiredo Being Iago Neves, a name and Pedro Santos another name, João Vitor and Larissa Figueiredo. I tried using the read command, but it read to...
asked by 26.05.2015 / 19:55