I am trying to add one item to the end of the list in the prolog, but it continues to fail.
insertAtEnd(X,[ ],[X]). insertAtEnd(X,[H|T],[H|Z]) :- insertAtEnd(X,T,Z). letters([a,b,c]).
I do not understand why this below does not work.
insertAtEnd(d,letters(Stored),letters(Stored)).
I am also trying to store this list in a variable stored everywhere, but I'm not sure if this is the right way.
Meowmeow
source share