I have browsed through various answers on SO about how to declare a list but I keep getting error messages. I am reading the section on lists from a book that I have but there still isn't an example on how to correctly declare them. I am doing a project for my class. I have a random set of questions but when the user answers one then that question cannot be repeated (questions are to be random).
I have this part done but I wanted to create a list so that when a question is asked, I want to add that question number to my list. I have tried various ways and I still can't do it!
test(N):- list(P), member(N, P).
list = [].
start :-
write('Answer the questions correctly'), nl,
X is 0,
push(X,list,[X|list]),
test(X).
This snippet is just to make the list code. As I understand it I want to push X, in this case 0, to the head of the list. Since my list was declared as empty I figure it would work. I am getting this error:
No permission to modify static procedure `(=)/2'
I have tried to understand what this means but because everyone's code is different there are many different answers and I am overwhelmed. This is my first time programming in Prolog.