Add a test for lazy evaluation.

This commit is contained in:
Danila Fedorin 2019-06-12 08:59:31 -07:00
parent 9d9c7b7e9f
commit 9855dda31a

17
programs/lazy.lily Normal file
View File

@ -0,0 +1,17 @@
data IntList = { Nil, Cons(Int, IntList) }
defn ones = { Cons 1 ones }
defn zipSum l r = {
case l of {
Nil -> { 0 }
Cons(lv, lt) -> {
case r of {
Nil -> { 0 }
Cons(rv, rt) -> {
(lv + rv) + zipSum lt rt
}
}
}
}
}
defn main = { zipSum (Cons 0 (Cons 1 Nil)) ones }