]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Map1.scl
Automatic execution of SCL tests in Maven
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Map1.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Map1.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Map1.scl
new file mode 100644 (file)
index 0000000..5d9f38c
--- /dev/null
@@ -0,0 +1,18 @@
+data List a = Nil | Cons a (List a)\r
+\r
+map f Nil = Nil\r
+map f (Cons h t) = Cons (f h) (map f t)\r
+\r
+map2 f l = run l\r
+  where\r
+    run Nil = Nil\r
+    run (Cons h t) = Cons (f h) (run t)\r
+\r
+map3 f l = run l\r
+  where\r
+    run Nil = Nil\r
+    run (Cons h t) = Cons (f h) (map f t)\r
+    \r
+main = "Foo"\r
+--\r
+Foo
\ No newline at end of file