Questions tagged [prolog-findall]

findall/3 is a built-in predicate of ISO Prolog.

66 questions
0
votes
1 answer

Finding all solutions in prolog

In prolog I'm trying to unify every valid pairing of needs with resources needs([ece2090,1,m,13,16]). needs([ece3520,1,tu,11,14]). needs([ece4420,1,w,13,16]). resources([joel, [ece2090,ece2010,ece3520,ece4420],[[m,13,16]]]). resources([sam,…
0
votes
2 answers

How can you add elements to a list or compute them from the knowledge base without using findall or assert/retract in Prolog?

I have a knowledge base that consists of students database in a file 'students.pl' like this: % student(Name,Percent,List_of_Marks_in_3_subjects). student('abc',83,[80,80,90]). student('pqr',70,[70,60,80]). student('xyz',76,[80,70,80]). I want to…
shujin
  • 181
  • 12
0
votes
1 answer

Print out a list without findall

I need to do a program in prolog which prints out a list(it has to be a list) of all the nodes of a tree on a level N given. I just can't manage to put the nodes into a list. Someone told me to use the function findall but it still won't work. I…
Ioana
  • 7
  • 4
0
votes
0 answers

Error in Prolog (SICStus) findall

I have a problem in a prolog program. The error is in predicate findall inside predicate moves. Anyone know why i got this error: ! Instantiation error in argument 1 of >= /2 ! goal: _1123>=0 % 1 The code is the following: moves(Board, Player,…
mistic
  • 275
  • 5
  • 15
-1
votes
2 answers

Prolog predicate doesn't resolve

This may be a rookie mistake, but I'm trying to solve this question: Find the query to obtain the following answer using the findall predicate: Obtain a list of persons who work in a city other than the one where they live: L = [suzy, paul]. This…
user3015224
  • 27
  • 2
  • 5
-1
votes
1 answer

JESS function similar to findall in Prolog?

I am wondering if it is possible to write a jess function or rules to behave findall in Prolog. For instance, we have a KB like (person (name jason) (school nyu)) (person (name john) (school nyu)) (person (name liz) (school cmu)) ... and the input…
youngtackpark
  • 1,475
  • 3
  • 12
  • 14
1 2 3 4
5