fold(X,[Y|Ys],Z) :- op(X,Y,V), fold(V,Ys,Z). fold(X,[],X). op(a,b,c).