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