9fe4d26c59
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1539 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
85 lines
1.6 KiB
Plaintext
85 lines
1.6 KiB
Plaintext
=================================================================
|
|
Logtalk - Object oriented extension to Prolog
|
|
Release 2.27.0
|
|
|
|
Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
|
|
=================================================================
|
|
|
|
|
|
% start by loading the example:
|
|
|
|
| ?- logtalk_load(aliases(loader)).
|
|
...
|
|
|
|
|
|
% check the object square(_) public protocol:
|
|
|
|
| ?- square(_)::current_predicate(Predicate).
|
|
|
|
Predicate = side/1 ;
|
|
Predicate = width/1 ;
|
|
Predicate = height/1 ;
|
|
Predicate = area/1
|
|
yes
|
|
|
|
|
|
% test the side/1 alias:
|
|
|
|
| ?- square(2)::side(Side).
|
|
|
|
Side = 2
|
|
yes
|
|
|
|
| ?- square(2)::predicate_property(side(_), Property).
|
|
|
|
Property = public ;
|
|
Property = static ;
|
|
Property = declared_in(rectangle(_G264, _G265)) ;
|
|
Property = defined_in(rectangle(_G297, _G298)) ;
|
|
Property = alias(width(_G182))
|
|
yes
|
|
|
|
| ?- square(2)::predicate_property(width(_), Property).
|
|
|
|
Property = public ;
|
|
Property = static ;
|
|
Property = declared_in(rectangle(_G262, _G263)) ;
|
|
Property = defined_in(rectangle(_G293, _G294))
|
|
yes
|
|
|
|
|
|
% check the object circle(_) public protocol:
|
|
|
|
| ?- circle(_)::current_predicate(Predicate).
|
|
|
|
Predicate = r/1 ;
|
|
Predicate = rx/1 ;
|
|
Predicate = ry/1 ;
|
|
Predicate = area/1
|
|
yes
|
|
|
|
|
|
% test the r/1 alias:
|
|
|
|
| ?- circle(3)::r(Radius).
|
|
|
|
Radius = 3
|
|
yes
|
|
|
|
| ?- circle(3)::predicate_property(r(_), Property).
|
|
|
|
Property = public ;
|
|
Property = static ;
|
|
Property = declared_in(ellipse(_G266, _G267)) ;
|
|
Property = defined_in(ellipse(_G299, _G300)) ;
|
|
Property = alias(rx(_G177))
|
|
yes
|
|
|
|
| ?- circle(3)::predicate_property(rx(_), Property).
|
|
|
|
Property = public ;
|
|
Property = static ;
|
|
Property = declared_in(ellipse(_G261, _G262)) ;
|
|
Property = defined_in(ellipse(_G292, _G293))
|
|
yes
|