2020-04-14 15:58:13 -07:00
|
|
|
data List a = { Nil, Cons a (List a) }
|
2020-04-09 23:48:53 -07:00
|
|
|
data Bool = { True, False }
|
|
|
|
defn length l = {
|
|
|
|
case l of {
|
|
|
|
Nil -> { 0 }
|
|
|
|
Cons x xs -> { 1 + length xs }
|
|
|
|
}
|
|
|
|
}
|
2020-04-14 15:58:13 -07:00
|
|
|
defn main = { length (Cons 1 (Cons 2 (Cons 3 Nil))) + length (Cons True (Cons False (Cons True Nil))) }
|