Questions tagged as 'prolog'

0
answers

Java query error to Prolog-Mysql in Fedora 22 (Netbeans)

I've been playing with Java doing consultations with Prolog with the JPL library and it works for me, all right up there. Then I made a Prolog connection to MySQL with ODBC and it worked great. Then I had a problem with making queries in Prol...
asked by 24.10.2016 / 03:15
1
answer

View the contents of the PROLOG knowledge base

I have a question about this program in PROLOG that they left me, it is about that by means of a predicate like: show. show me all the content of the knowledge base that is flight, but the truth is that I have not found much about how to do it...
asked by 07.11.2018 / 01:59
1
answer

Split into two a list from a point or character - Prolog?

I want to develop the following exercise in Prolog . I have a list Lista = [a,b,c,d,f,g,h,i] and I want to split it in two when I find for example the character ' d ' so the result would be the same: L1 = [a,b,c] L2 = [f,g,h,i] I a...
asked by 07.10.2017 / 16:13
1
answer

how to transform a structure matrix to a list matrix in prolog

I have this entry in Prolog and I ask for the function x X((1,0,1,0),(1,0,1,0)) and I want to get it out [[1,0,1,0],[1,0,1,0]] how could I do? I know that the function univ converts me to list and vice versa but if I put X...
asked by 10.07.2017 / 01:42
0
answers

How to insert facts into the knowledge base in prolog permanently

I would like to know how to insert new facts into the knowledge base permanently. I know there is asserta () and assertz (), however they retain the facts within the knowledge base until the prolog process is completed. For example I have a c...
asked by 03.01.2019 / 19:46
2
answers

count if a number on a list is less than a given number in prolog

Hello you will see the problem is that given for example a list [1,9,3,5,2,6,4,7,8] this takes each value from the list and says if when this number appears N has some value lower than it and will tell them where at the end everything will be ad...
asked by 05.12.2018 / 18:10
0
answers

Inconveniences with an "exception" prolog

You will see my code consists of placing a mosaic of 8 pieces (a list of lists) and a number N that indicates the number of steps you will take, and you have to show if with that number N you can reach the final state (state resolved) of the mos...
asked by 12.12.2018 / 23:09
0
answers

Prolog, I need to get the month of greatest expense

gasto_mes(enero,servicios,500). gasto_mes(enero,impuestos,2000). gasto_mes(febrero,servicios,700). gasto_mes(marzo,servicios,800). gasto_mes(marzo,impuestos,1800). gasto_mes(abril,servicios,900). gasto_mes(mayo,servicios,940). gasto_mes(mayo,impu...
asked by 12.11.2018 / 02:52
0
answers

I need help with a ternary tree in Prolog

Write a program in Prolog that traverses a terrarium in depth and calculate the sum of each branch from the root to a leaf. The resulting sums must be returned in a list in the order in verse followed by walking the tree.     
asked by 21.11.2018 / 01:42
1
answer

Find the number of elements greater than a number in a list in PROLOG

Hello and thank you for taking the time to read this question. I have the following problem: Given a list that returned the number of numbers greater than X Example: greater (4, [1,2,3,4,5,6], N) Result. N = 2 may(0,[],0):-!, fail. may(N,[N...
asked by 21.10.2018 / 22:46