An example might help here.
add(X,Y,Sum):- Sum is X+Y. sum(Xs,Sum):- foldl(add,Xs,0,Sum). :- sum([1,2,3],S). S = 6.
As per the documentation, each element of Xs is used as the leftmost argument of Goal ('add' in the example). V0 and V1 are used as the last arguments in Goal. In our example, V0=0 and V1=Sum, so 0 and Sum are used as the last arguments of 'add'.