42aabce1bb
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1973 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
60 lines
944 B
Plaintext
60 lines
944 B
Plaintext
================================================================
|
|
Logtalk - Open source object-oriented logic programming language
|
|
Release 2.30.7
|
|
|
|
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
|
|
================================================================
|
|
|
|
|
|
% load the example:
|
|
|
|
| ?- logtalk_load(birthdays(loader)).
|
|
...
|
|
|
|
|
|
% create two new agents, Paul and Nathalie:
|
|
|
|
| ?- agent::(new(paul, 40, male), new(nathalie, 32, female)).
|
|
|
|
Yes
|
|
|
|
|
|
% make them friends:
|
|
|
|
| ?- paul::new_friend(nathalie).
|
|
|
|
Yes
|
|
|
|
|
|
% it's birthday for Nathalie:
|
|
|
|
| ?- nathalie::birthday.
|
|
|
|
Happy birthday from paul!
|
|
Thanks! Here, have a slice of cake, paul.
|
|
Thanks for the cake nathalie!
|
|
Say goodbye to your 32's!
|
|
|
|
Yes
|
|
|
|
|
|
% ask Nathalie her age:
|
|
|
|
| ?- nathalie::age(Age).
|
|
|
|
Age = 33
|
|
|
|
Yes
|
|
|
|
|
|
% a year goes by...
|
|
|
|
| ?- nathalie::birthday.
|
|
|
|
Happy birthday from paul!
|
|
Thanks! Here, have a slice of cake, paul.
|
|
Thanks for the cake nathalie!
|
|
Say goodbye to your 33's!
|
|
|
|
Yes
|