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/ph/regular_polygon.lgt

32 lines
474 B
Plaintext
Raw Normal View History

:- object(regular_polygon,
extends(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.