This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/shapes/ch/regular_polygon.lgt
pmoura 0df93ffc6e Logtalk 2.15.6 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@970 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2004-02-09 14:18:27 +00:00

33 lines
512 B
Plaintext

:- object(regular_polygon,
instantiates(abstract_class),
specializes(polygon)).
:- info([
author is 'Paulo Moura',
version is 1.1,
date is 2004/1/8,
comment is 'Generic regular polygon.']).
:- public(side/1).
:- mode(side(?atom), zero_or_one).
:- info(side/1, [
comment is 'Regular polygon side length.',
argnames is ['Length']]).
side(1). % default side length
perimeter(Perimeter) :-
::nsides(Number),
::side(Side),
Perimeter is Number*Side.
:- end_object.