I am thinking how to multiply all elements of two list with each other. Then I want to put all results in List3. For example,
List3
List1 = [1,3,5]. List
Why not
prod(L1, L2, LP) :- bagof(P, X^Y^(member(X, L1), member(Y, L2), P is X * Y), LP).