From 88c9418350728ceef47c1664a90846dd6e6e7085 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 14 Apr 2020 15:58:13 -0700 Subject: [PATCH] Update example to include polymorphism --- code/compiler/11/examples/works3.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/compiler/11/examples/works3.txt b/code/compiler/11/examples/works3.txt index 2123089..cfd2ef3 100644 --- a/code/compiler/11/examples/works3.txt +++ b/code/compiler/11/examples/works3.txt @@ -1,4 +1,4 @@ -data List = { Nil, Cons Int List } +data List a = { Nil, Cons a (List a) } data Bool = { True, False } defn length l = { case l of { @@ -6,4 +6,4 @@ defn length l = { 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))) }