]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Lambda.scl
Merge commit 'd186091'
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Lambda.scl
1 \r
2 data List a = Nil | Cons a (List a)\r
3 \r
4 map :: (a -> b) -> List a -> List b\r
5 map f Nil        = Nil\r
6 map f (Cons h t) = Cons (f h) (map f t)\r
7 \r
8 constMap :: a -> List b -> List a\r
9 constMap c = map (\x -> c)\r
10 \r
11 main = constMap (5 :: Integer) (Cons (1 :: Integer) (Cons (2 :: Integer) (Cons (3 :: Integer) Nil)))\r
12 --\r
13 (Cons 5 (Cons 5 (Cons 5 Nil)))