Code for the compiler described in my blog
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
data List a = { Nil, Cons a (List a) }
|
|
data Bool = { True, False }
|
|
defn length l = {
|
|
case l of {
|
|
Nil -> { 0 }
|
|
Cons x xs -> { 1 + length xs }
|
|
}
|
|
}
|
|
defn main = { length (Cons 1 (Cons 2 (Cons 3 Nil))) + length (Cons True (Cons False (Cons True Nil))) }
|
|
|