0
votes

this is my source code , can someone tell me what is error , and wat is the best way to do this , i want to show out who matching who ...can somebody help me ?

   % Author:
   % Date: 08-Sep-11
   person(may,female,25,blue).
   person(john,male,30,blue).
   match:-person(Fn,'female',Fage,Fatt),
          person(Mn,'male',Mage,Matt),
          Fage<=Mage,
          Fatt=Matt,
           write(Fn ,'-- match with----',Mn).


   error message :55 ?- match.
                        ERROR: Undefined procedure: match/0
                        ERROR:     However, there are definitions for:
                        ERROR:         catch/3
                        false.
1
Works for me. Compiler didn't like Fage<=Mage for some reasons. - Andrey
i got error , i using swi prolog , can idea how to change it ? - fewer
I can't reproduce your error thus can't help. What are your steps? - Andrey
i change it to other way ... match(Fn,Mn):-person(Fn,'female',Fage,Fatt), person(Mn,'male',Mage,Matt), Mage>=Fage, Fatt=Matt. write('Matching Result'). - fewer

1 Answers

0
votes
match :-
    person(Fn,female,Fage,Fatt),
    person(Mn,male,Mage,Matt),
    Fage =< Mage,
    Fatt = Matt,
    format('~w~s~w~n',[Fn ,'-- match with----',Mn]).