[mercury-users] more Mercury homework: "Mercuryfy" some simple Prolog

Jean-Marc Vanel jeanmarc.vanel at gmail.com
Fri Sep 24 00:30:15 AEST 2010


Hi

I'm in the middle of translating into Mercury some simple Prolog from the
book "the Art Of Prolog" , namely Program 2.1:  Defining family
relationships :

        uncle(Uncle,Person) :-
                brother(Uncle,Parent), parent(Parent,Person).

And, again, I do not find much help in the documentation.

First , I put this is interface :
:- type person.

But, then, what to put in the implementation, which would the equivalent of
an empty class in Java ?


A 2nd problem is with pure database predicates (primitives), like brother. I
put this :
:- pred brother( person, person) is multi .
:- mode brother( in, out ) is multi .
:- mode brother( out, in ) is multi .

But the compiler is not happy :
Error: no clauses for predicate `brother'/2.

Let's suppose that brother/2 is provided by external facts .

-- 
Jean-Marc Vanel
Consulting, services, training,
Rule-based programming, Semantic Web
http://jmvanel.free.fr/
EulerGUI, a turntable GUI for Semantic Web + rules, XML, UML, eCore, Java
bytecode
+33 (0)6 89 16 29 52 -- +33 (0)1 39 55 58 16
( we rarely listen to voice messages, please send a mail instead )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20100923/afb5aef5/attachment.html>


More information about the users mailing list