18 lines
387 B
Plaintext
18 lines
387 B
Plaintext
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 }
|