SOE ex.8.2



-- area (RtTriangle s1 s2) = s1 * s2 / 2
area (RtTriangle s1 s2) = abs (s1 * s2 / 2)

-- perimeter (RtTriangle s1 s2) = s1 + s2 + sqrt (s1 ^ 2 + s2 ^ 2)
perimeter (RtTriangle s1 s2) = abs s1 + abs s2 + sqrt (s1 ^ 2 + s2 ^ 2)

-- data Shape = RtTriangle Float Float

{-
Book's question: on section 8.2.2

How should we encode the meaning of a shape in Haskell?
It would seems foolhardy to try to build the entire set,
or list, of all of its points. (Why?)

Because there are infinity of points due to density of Real number.
(Ex. 0.0, 0.1, 0.01, 0.001, 0.0001, …. )
-}

Leave a Reply