Solution 2-3
Here is a suggested solution for Étude 2-3.
geom.erl
%% @author J D Eisenberg <jdavid.eisenberg@gmail.com>
%% @doc Functions for calculating areas of geometric shapes.
%% @copyright 2013 J D Eisenberg
%% @version 0.1
-
module
(
geom
).
-
export
([
area
/
2
]).
%% @doc Calculates the area of a rectangle, given the
%% length and width. Returns the product
%% of its arguments.
-
spec
(
area
(
number
(),
number
())
->
number
()).
area
(
L
,
W
)
->
L
*
W
.
Get Études for Erlang now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.