prolog expanding predicate to iterate for multiple results, combining / resolving result sets <p>I have a predicate "lookupOptions" which returns one by one some lists (Menus).</p> <p>I'm trying to get it to satisfy the case of multiple inputs. I can return a single set of options as follows, by reading the head of the "list_places" list. </p> <pre><code>find_options(Restaurant,Town,Menu) :- lookupOptions(Restaurant,H,Menu), list_places(Town,[H|T]) </code></pre> <p>But, I'm not able to get it to iterate.</p> <p>I have tried a lot of things, these were my best efforts so far.</p> <p>a) standard enough iteration, but it wont resolve ...</p> <pre><code>doStuff(X,[],_). doStuff(Restaurant,[H|T],_):- lookupOptions(Resturant,H,_), doStuff(Restaurant,T,_). find_options(Restaurant,Town,Menu) :- doStuff(Restaurant,[H|T],Menu), list_places(Town,[H|T]). </code></pre> <p>b) expanding the goal predicate ...</p> <pre><code>find_options(_,Town,[H|T],_) find_options(Restaurant,Town,Menu) :- find_options(Restaurant,Town,[],Menu). find_options(Restaurant,Town,X,Menu) :- list_places(Town,X). find_options(Restaurant,Town,[H|T],Menu) :- lookupOptions(Restaurant,[H],Menu), find_options(Restaurant,Town,T,Menu). </code></pre> <p>Would either of these work ? if the pattern was written correctly. Or if there was an appropriate cut put in place?</p> <p>Any help most appreciated ... </p>