lily/programs/lazy.lily

18 lines
387 B
Plaintext
Raw Permalink Normal View History

2019-06-12 08:59:31 -07:00
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 }