findall/3 is a built-in predicate of ISO Prolog.
Questions tagged [prolog-findall]
66 questions
1
vote
0 answers
How to find all perfect matching in bipartite graph using Prolog?
I'm trying to find all perfect matching in bipartite graph and then do some nontrivial evaluations of each solution (nontrivial means, I can not use Hungarian algorithm).
I use Prolog for this, is there any not exponential solution? (If the result…

marek094
- 424
- 2
- 11
1
vote
1 answer
Prolog - Operation inside findall
Using a findall in Prolog how can I perform operations inside the goal without affecting backtracking?
The following example explains what I'm trying to achieve:
value('M1', 11, 3).
value('M2', 11, 3).
connection('M1',1, 'A',…

wyldkat
- 13
- 4
1
vote
1 answer
Findall inside findall
it is possible make something like this?
--- knowledge base ---
linha( 5,[bobigny_pablo_picasso,bobigny_pantin_raymon_queneau,eglise_de_pantin,hoche,
porte_de_pantin,ourcq,laumiere,jaures,stalingrad,gare_du_nord,gare_de_l_est,
…

user3161343
- 63
- 5
1
vote
2 answers
Correct use of findall/3, especially the last result argument
I'm a beginner in Prolog and I am dealing with a problem that might seem stupid to you, but I really can't understand what I'm doing wrong! Ok, I have this file fruits.pl and inside that I have something like…

elli
- 1,109
- 1
- 13
- 20
1
vote
1 answer
Prolog findall/3
Say I have a predicate pred containing several facts.
pred(a, b, c).
pred(a, d, f).
pred(x, y, z).
Can I use findall/3 to get a list of all facts which can be pattern matched?
for example, if I have
pred(a, _, _)
I would like to obtain
[pred(a, b,…

bsky
- 19,326
- 49
- 155
- 270
1
vote
1 answer
Removing duplicates from a list generated with Findall
I'm practicing Prolog by coming up with a very simple database of who has sent and received emails.
I have created a list using findall of the receivers of a pre-specified X.

OpalRing
- 15
- 1
- 4
1
vote
3 answers
How to get a list of objects in Prolog
I was resolving some prolog exercises when I fond myself with some difficulties resolving the following one:
Consider you have this fact base about object:
object(obj1).
object(obj2).
object(obj3).
object(obj4).
object(obj5).…

out_sider
- 11
- 2
1
vote
2 answers
Finding all unifications in prolog
I wrote my first simple code in PROLOG:
is_beginning([], _).
is_beginning([FirstLetterB|RestWordB], [FirstLetterW|RestWordW]) :-
FirstLetterB == FirstLetterW,
is_beginning(RestWordB, RestWordW).
It is designed to find out if first argument of…

Yester
- 652
- 6
- 18
0
votes
1 answer
Prolog - The same functioning but with no findall
Does anyone know how I could implement I predicate doing what this one does but without "findall"?
Thank you a lot.
domains
oferta = rebaixat ; normal
element = string
list = element*
database
producte (string, integer,…

mkll
- 41
- 9
0
votes
2 answers
Implementing a simple version of Prolog findall without using the built-in findall
I am trying to implement a simple version of findall in Prolog without using the built-in findall or similar built-in predicates -- just as a learning exercise.
For example, suppose there is a relation a/1 in my database,
a(1).
a(11).
a(13).
and I…

PaulM
- 305
- 1
- 8
0
votes
2 answers
How to add an element to a list in prolog
I want to add the first element of a list to another list using this:
findall(X, nth1(1, List1, X,), List2).
but it returns false.
Someone knows why?

morax
- 1
0
votes
1 answer
finding the number of solutions in a list on prolog
I am trying to find how to find the number of solutions in a script. my current script is:
ksol(K,ST) :- length(L1,K), maketemplate(L1,ST,K), kset(Kset,K),
asserta( (qn(K))),asserta( (st(ST))), asserta( (kset(Kset)) ).
%…

niconico
- 9
- 2
0
votes
1 answer
How to formulate an exception for findall/3 correctly?
I have startet to learn Prolog and I want to get a list of opponents of players with findall/3. In the Generalization I just want to add only the opponents to the list who are actually players, except the player I am asking for itself. How can I…

Carsten H
- 831
- 15
- 32
0
votes
0 answers
Sum up data from facts
(Given a list of movies, write a PROLOG rule to add and display the total takings.)
This is my question I am basically trying to add an integer value give a list of movies from the list below. I am quite new in Prolog and I don't really understand…

Zisis Kostakakis
- 61
- 6
0
votes
1 answer