]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ListSyntax10.scl
Automatic execution of SCL tests in Maven
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / ListSyntax10.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ListSyntax10.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ListSyntax10.scl
new file mode 100644 (file)
index 0000000..726dba5
--- /dev/null
@@ -0,0 +1,12 @@
+import "Prelude"\r
+\r
+dists l = sum [sqrt (dx*dx + dy*dy) \r
+              | i <- [0..length l-2]\r
+              , (x1,y1) = l!i\r
+              , (x2,y2) = l!(i+1)\r
+              , dx = x1-x2\r
+              , dy = y1-y2 ]\r
+              \r
+main = dists [(0,0),(1,1),(2,0)]\r
+--            \r
+2.8284271247461903
\ No newline at end of file