tags:

views:

68

answers:

2

I get several results with the same outputs.

I want to get jack,jane only one time, but I get it two times.

How can I avoid this? I tried setof but I couldn't get it done. Please can someone help me on this?

+1  A: 

try this link

xscape
+1  A: 

This question is duplicated in "How to stop repetitions in rules in prolog".

An answer is to do something like this:

solve :-
    marriedcouple(Dad, Mum),
    not(found(marriedcouple(Dad, Mum))),
    assert(found(marriedcouple(Dad, Mum))),
    write([Dad, Mum]),
    nl,
    fail.

Read the full answer for more detail.

Enigmativity
i tried that solution but its not working. i really dont know why. it says those undefined
Nubkadiya
@Pradeep - what did you try and what "those" are undefined?
Enigmativity