Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove in Prolog

Status
Not open for further replies.

mjhawk

IS-IT--Management
Nov 6, 2002
1
US
I am new to Prolog and need some assistance. I have this problem where the goal is to write a program to remove all items bought from your buying list with
remove(Buy+,Bought+,Rest-) where Buy is a list of items needed, Bought is a list of items bought, and Rest is a list of items you still have to buy.
 
the best i can do

remove(X,[X|K],K).
remove(X,[K|L],[K|R]) :- remove(X,L,R).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top