Q:

In Prolog, how can I check for N of elements in list A in list B?

I have these two lists = 
fruits([banana, apple, mangoes, pears]).
foodILike([hamburgers, banana, shakes, fries]).

I want to write a prolog predicate that will return true as soon as it sees 1 items in the foodsILike list in the fruits list. How can I go about doing so? 

A:

First, for the plain answer:
fruitsILike(F) :-
  fruits(Fs)
  member(F, Fs),
  foodILike(Ls),
  member(F, Ls).

You could avoid the membership check by flattening the fruits and foods lists:
fruit(banana).
fruit(apple).
...
foodILike(hamburger).
foodILike(banana).
...
fruitsILike(F) :-
  fruit(F),
  foodILike(F).

That said, you seem to try and solve problems in Prolog using imperative idioms, and that won't work.  First, predicates do not return anything.  When calling a predicate, Prolog unifies its arguments with valid values according to the facts and rules in the program.  Therefore, the "returned value" are the assignments to unbound variables.  Second, Prolog does not do something "as soon as".  It iterates over all possible solutions.  You get the first solution, then the second solution, and so on.

