浏览代码

Create the point data structure and distance function

DricomDragon 5 年之前
父节点
当前提交
35f1d8d5d4
共有 1 个文件被更改,包括 6 次插入0 次删除
  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))