このディレクトリの索引

#  I'm trying to write a family tree program in Prolog for my homework. This is a part of the code.
#  
#  /** a sample fact **/
#  parents(someone, someoneelse, child).
#  
#  /** are M and F parents of the children in the given list? **/
#  parents(M,F,[]) :- parents(M,F,_).
#  parents(M,F,[First|Rest]) :- parents(M,F,First), parents(M,F,Rest).
#  
#  /** are M and F parents? **/
#  parents(M,F) :- parents(M,F,_).
#  

parents_list(Children_list,Parents_list) :-
        findall([M,F,Children],(
                    parents(Children_list,M,F,Children)),
                Parents_list).

parents([Children|Rest],M,F,Children) :-
        parents(M,F,Children).
parents([_|Rest],M,F,Children) :-
        parents(Rest,M,F,Children).