------------------------------------------------------------------------------
MC logo
CSc 404 Assignment 5
[^] CSc 404 Home
------------------------------------------------------------------------------
[CSc 404 Assignment 1] [CSc 404 Assignment 2] [CSc 404 Assignment 3] [CSc 404 Assignment 4] [CSc 404 Assignment 5] [CSc 404 Assignment 6]

Your New Uniform

Assigned
Due
Apr 4
Apr 13
30 pts
Create a prolog relation which takes an item and a list and asserts that all members of the list are the indicated item. Place it in a text file with ending .pl so it can be consulted. Like so:
?- consult(inc).
true.

?- isall(eek,[eek,eek,eek,eek]).
true ;
false.

?- isall(hay,[hay,hay,hay,hay,needle,hay,hay]).
false.

?- isall(foo,[bar]).
false.

?- isall(X,[a,a,a,a,a]).
X = a.

?- isall(b,[b,b,Z]).
Z = b.

?- isall(X,[c,c,c,c,Y,c]).
X = Y, Y = c.

?- isall(www,[]).
true.

?- isall([a,b,c],[[a,b,c],[a,b,c]]).
true.

?- isall(P,[a,a,P,b]).
false.

?- isall(q,X).
X = [] ;
X = [q] ;
X = [q, q] ;
X = [q, q, q] ;
X = [q, q, q, q] ;
X = [q, q, q, q, q] .

?- 

Note that on the last one, the system was offering additional solutions, but I told it to stop.

Submission

When your function works, is nicely formatted and documents, submit it using this form.