Exercise 2.1: Three Circles
Given: an array of three real values, r, for the radii of three circles;
Compose: a let-in statement that returns two arrays containing the areas and circumferences of the circles of the given radii.
let pi := 3.14159;
area1 := r[1] * r[1] * pi;
area2 := r[2] * r[2] * pi;
area3 := r[3] * r[3] * pi;
circ1 := 2.0 * r[1] * pi;
circ2 := 2.0 * r[2] * pi;
circ3 := 2.0 * r[3] * pi;
in array [ 1: area1, area2, area3 ],
array [ 1: circ1, circ2, circ3 ]
end let
Previous Section
If you have any questions about this page, or want more information about the
Sisal Language Project, contact:
John Feo at (510) 422-6389 or feo@diego.llnl.gov, or
Tom DeBoni at (510) 423-3793 or deboni@llnl.gov.
The Sisal Language Project has been approved as a Designated Unclassified Subject Area (DUSA) K19222, as of 07 August, 1991.
LLNL Disclaimer
UCRL-MI-122601