how to refractor this ?

Roelof Wobben <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
I have this piece: 

siblings(Child, Sibling) :-
   same_father(Child, Sibling),
   Child \= Sibling.
 siblings(Child, Sibling) :-
   same_mother(Child, Sibling),
   Child \= Sibling.

display_siblings(X,Y):-
     setof(X-Y, (siblings(X,Y), X @< Y), Sibs),
     write(Sibs).

brother_child(Child, Brother) :- 
     siblings(Child, Brother), 
     male(Brother).

display_brother(X,Y) :-
      setof(X-Y, (brother_child(X,Y), X @< Y),Brother),
      write(Brother).

sister_child(Child, Sister) :- 
     siblings(Child, Sister), 
     female(Sister).

display_sister(X,Y) :-
      setof(X-Y, (sister_child(X,Y), X @< Y),Sister),
      write(Sister).

As you can see the display are almost the same except the calling rule and the name of the variable.

Is there a way I can make one big display function. 
and can I refractor more here ?

Roelof

 		 	   		  
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.