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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

leading list

Status
Not open for further replies.

xristiana

Programmer
Oct 23, 2010
48
GR
Hello everyone,

I have to write two programms with lists, with two arguments. In the first programm the first argument(list)must lead the second(list) and in the second programm the opposite. I don't understand the theory very well, when I have news I'll inform you, unless you understand it first, but I made a programm which I don't know what exactly does. It's the following:
leading_list([],Y).
leading_list(Head|X1,Head|Y1):-leading_list(X1,Y2).\
I thought I had understood what leading means, but now I know I haven't.
Can anyone tell me what this programm does, and give me an idea how the programm for example (programm)1 should be? Unless you don't understand it and I will explain it to you when I find out. Thanks.
 
Sorry the \ was unecessary and instead of Y2 in the end of the second rule, I should have put Y1. Sorry again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top