# Solution

%% The base case: both lists are empty. %% The result is 0. dot([],[],0). %% The recursive case: neither of the lists is empty. %% For the result, we first compute the dot product of the tails of %% the two input lists. Then, we add the product of the two heads. dot([InHead1|InTail1],[InHead2|InTail2],Result) :- dot(InTail1,InTail2,ResultTails), Result is (InHead1 * InHead2) + ResultTails.