Update example to include polymorphism

This commit is contained in:
Danila Fedorin 2020-04-14 15:58:13 -07:00
parent 2255543d94
commit 88c9418350

View File

@ -1,4 +1,4 @@
data List = { Nil, Cons Int List } data List a = { Nil, Cons a (List a) }
data Bool = { True, False } data Bool = { True, False }
defn length l = { defn length l = {
case l of { case l of {
@ -6,4 +6,4 @@ defn length l = {
Cons x xs -> { 1 + length xs } Cons x xs -> { 1 + length xs }
} }
} }
defn main = { length (Cons True (Cons False (Cons True Nil))) } defn main = { length (Cons 1 (Cons 2 (Cons 3 Nil))) + length (Cons True (Cons False (Cons True Nil))) }