]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Lambda.scl
(refs #7307) Added features field to SCL module header
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Lambda.scl
1
2 data List a = Nil | Cons a (List a)
3
4 map :: (a -> b) -> List a -> List b
5 map f Nil        = Nil
6 map f (Cons h t) = Cons (f h) (map f t)
7
8 constMap :: a -> List b -> List a
9 constMap c = map (\x -> c)
10
11 main = constMap (5 :: Integer) (Cons (1 :: Integer) (Cons (2 :: Integer) (Cons (3 :: Integer) Nil)))
12 --
13 (Cons 5 (Cons 5 (Cons 5 Nil)))