%% eat(Start,End,Pairs,List). %% Takes the first item, the last item, the list of relations between items, and gives the list of steps through the relations %% eat(hand,colon,[[hand,mouth],[mouth,stomach],[stomach,intestines],[intestines,colon]],List). List=[hand,mouth,stomach,intestines,colon]. %% predicate name %% eat = to eat a piece of food %% variables %% Start = the first part of the body %% End = the last part of the body %% Pairs = the parts of the body that are connected %% List = the list of the body parts /** start(lefthand). start(righthand). end(colon). pairs([hand,mouth],[mouth,stomach],[stomach,intestine],[intenstine,colon]). eat(X,End,Pairs,List) :- Star(X) **/ a(Nums,List) :- a(Nums,[],List). a([Head|Tail], List1, List2) :- Num is Head + 1, append(List1, [Num], List3), a(Tail, List3, List2). a([],List,List).