X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FLambda.scl;fp=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FLambda.scl;h=2316b30b4aa99a31c077114248ee83d1385a981c;hp=0000000000000000000000000000000000000000;hb=0364f8f54b009e9e5de482d5c9d1cb7efb023141;hpb=7ecf07ff9aacab300f1fb900f1f0f97beb1be139 diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Lambda.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Lambda.scl new file mode 100644 index 000000000..2316b30b4 --- /dev/null +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Lambda.scl @@ -0,0 +1,13 @@ + +data List a = Nil | Cons a (List a) + +map :: (a -> b) -> List a -> List b +map f Nil = Nil +map f (Cons h t) = Cons (f h) (map f t) + +constMap :: a -> List b -> List a +constMap c = map (\x -> c) + +main = constMap (5 :: Integer) (Cons (1 :: Integer) (Cons (2 :: Integer) (Cons (3 :: Integer) Nil))) +-- +(Cons 5 (Cons 5 (Cons 5 Nil))) \ No newline at end of file