hi
i am new in visual prolog and i read some book about it but i can't define fact and rule in visual prolog
this is my program :
%fact
parent( pam, bob).
parent( bob, liz).
%rule
grandparent(X,Z):-parent( X, Y),parent( Y, Z).
%goal
edit3_ctl:setText=grandparent( edit1_ctl:getText(), edit2_ctl:getText()).
any body can give me this project in visual polog for helping me to start learning visual prolog ?
thanks
- Ferenc Nagy
- VIP Member
- Posts: 215
- Joined: 24 Apr 2007 12:26
Family example of the Visual Prolog 5.2
Hi,
The attached archive is the family example of the earlier version of Prolog.
You can use in an Easywin project or add the "let us blind the peasant" MDI user interface.
You may continue like
predicates
cousin(string, string).
clauses
cousin(A,B) :-
grandfather(G,A),grandfather(G,B).
The attached archive is the family example of the earlier version of Prolog.
Code: Select all
Here I quote the main code:
/*****************************************************************************
Copyright (c) 1984 - 2000 Prolog Development Center A/S
Project: FAMILY
FileName: FAMILY.PRO
Purpose: No description
Written by: Visual Prolog
Comments:
******************************************************************************/
database - tmp
son(STRING,STRING)
sister(STRING,STRING)
brother(STRING,STRING)
married(STRING,STRING)
clauses
son("John","Dan").
sister("Mary","Suzan").
brother("Harold","Larry").
married("John","Mary").
married("Larry","Sue").
predicates
father(STRING father,STRING child)
grandfather(STRING grandfather,STRING grandchild)
sister_in_law(STRING,STRING)
clauses
father(A,B):-
son(B,A).
grandfather(A,B):-
father(A,C),
father(C,B).
sister_in_law(A,B):-
married(A,C),
sister(C,B).
sister_in_law(A,B):-
brother(A,C),
married(C,B).
goal
sister_in_law("John",Z),
format(Msg,"sister_in_law(\"John\",%)",Z),
write(Msg).
%goal
% sister_in_law("Harold",Z).
You may continue like
predicates
cousin(string, string).
clauses
cousin(A,B) :-
grandfather(G,A),grandfather(G,B).
- Attachments
-
- VIP52_FAMILY_EXAMPLE.ZIP
- (3.94 KiB) Downloaded 600 times
TIA, Regards,
Frank Nagy
Frank Nagy
- Thomas Linder Puls
- VIP Member
- Posts: 1401
- Joined: 28 Feb 2000 0:01
In the IDE: Help -> Install Examples... will install examples.
In the installed examples folder you will find the project _tutorial\family\family1\family1.prj6.
It contains the code corresponding to the tutorial: Fundamental Visual Prolog.
In the installed examples folder you will find the project _tutorial\family\family1\family1.prj6.
It contains the code corresponding to the tutorial: Fundamental Visual Prolog.
Regards Thomas Linder Puls
PDC
PDC