Преглед изворни кода

Implement the perimeter function

DricomDragon пре 5 година
родитељ
комит
d3e6558eb6
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      geometry.hs

+ 2 - 2
geometry.hs

@@ -9,5 +9,5 @@ distance p1 p2 =
 
 perimeter sh = case sh of
 	Singularity _ -> 0.0
-	Circle _ _ -> 1.0
-	Square _ _ -> 2.0
+	Circle r _ -> 3.14 * 2 * r
+	Square (Point a b) (Point c d) -> 2 * abs (a - c) + 2 * abs (b - d)