%% Dogs don't reconsider what they do %% The ravenous dog delicately dessicated the delicious dog biscuits. %% list(dog,[[dog,ravenous],[ravenous,dog-biscuits],[dog-biscuits,delicious],[delicious,dessicated],[dessicated,delicately]],[delicately],List). %% list(+Start,+Pairs,+Ends,-List) - prints a list of words one of which follows the previous one when thinking about the previous one. %% Start - the first word %% Pairs - the list of words each of which follows another word %% Ends - the list of last words %% List - the final list of words list(Start,Pairs,Ends,List) :- list(Start,Pairs,Ends,[Start],List). %% list(+Start,+Pairs,+Ends,+List,-List) - prints a list of words one of which follows the previous one when thinking about the previous one. %% Start, Pairs, Ends described in list/4 %% List1 - the initial list of words %% List2 - the final list of words list(Start,Pairs,End,List1,List2) :- member(Pair,Pairs), Pair=[Start,Next], append(List1,[Next],List3), list(Next,Pairs,End,List3,List2). list(End,_,Ends,List,List) :- member(End,Ends).