Parcourir la source

Create the point data structure and distance function

DricomDragon il y a 5 ans
Parent
commit
35f1d8d5d4
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6 0
      geometry.hs

+ 6 - 0
geometry.hs

@@ -0,0 +1,6 @@
+data Point = Point Float Float
+
+distance p1 p2 = 
+	let (Point a b) = p1 in
+		let (Point c d) = p2 in
+			sqrt ((a - c) * (a - c) + (b - d) * (b - d))