Structure (Difference Lists) Prolog
问题 This question refers to the material in chapter 3 of the book: Programming in Prolog, Clocksin and Mellish, Ed 5 In page 72 of this book, a program using difference list is displayed: partsOf(X,P):- partsacc(X,P,Hole) , Hole=[]. partsacc(X,[X|Hole],Hole):-basicpart(X). partsacc(X,P,Hole):- assembly(X,Subparts), partsacclist(Subparts, P, Hole). partsacclist([],Hole,Hole). partsacclist([P|T], Total, Hole):- partsacc(P,Total,Hole1), partsacclist(T,Hole1,Hole). In many tutorials online, the