]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/ListSyntax10.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / ListSyntax10.scl
diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/ListSyntax10.scl b/bundles/org.simantics.scl.compiler/tests/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