INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How: member-x in a list is also member-y

How: member-x in a list is also member-y

(OP)
Hello! I am new here in the forum, and I also a noob in programming Prolog, so if you could help me, I would very much appreciate it :)
How can I write in Prolog the following: that a member of a list, let's say, member1 is also member2 or member3, but not both of them?

Thank you very much!
Shizuka

RE: How: member-x in a list is also member-y

That's not very clear !
What do you mean by member1 is also member2 ?
Can you give an example with a list !

RE: How: member-x in a list is also member-y

(OP)
Thank you for answering.
I am doing a "game" in which I have six suspects with different traits:

suspect(Name, Age, Weapon, Shape, Object, Shoes)
The goal is to implement a series of clues so that the program says which the different traits of all the six suspects. For example:

suspect(Valdemort,150,winchester,'in good shape',book,'high heels').

I am having difficulties with this clue:

or(suspect1, suspect2, suspect3, listOfSuspects)

This clue is supposed to say that the suspect1 has the same traits as suspect2 OR as suspect3 but not both. Example: To indicate that the suspect who is 50 years old has a ring or a mac, but not both:

or(suspect(_, 50, _, _, _, _),
suspect(_, _, _, _, ring, _),
suspect(_, _, _, _, mac, _), listOfSuspects).

Thanks for helping.

RE: How: member-x in a list is also member-y

Is is possible that sameas(S1, S2) and sameas(S1, S3) implies sameas(S2,S3) ?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close