I am working with GNU prolog. I have the following facts that represent a school with students, where a student buddy is matched with multiple students, but not all students need to have a buddy:
school(sc).
student(s1, sc).
student(s2, sc).
student(s3, sc).
student(s4, sc).
In the following case, s2's and S3's student buddy is s1.
studentBuddy(s2, s1).
studentBuddy(s3, s1).
I want a rule that prints out all the students who do not have a student buddy in a particular school. I have the following rules:
isStudentBuddy(S) :- studentBuddy(A, S).
printAllRegularStudents(SC) :- not(studentBuddy(A)), student(A, SC), write(A), nl, fail.
The second rule is the one that prints out all regular students (students who are not student buddies. However, this results in an error and I cannot figure out why?