From e70c4d8688dba2a40aff0846debad3c2fa919bb9 Mon Sep 17 00:00:00 2001 From: kevinazhou150 Date: Fri, 14 Jul 2023 20:25:52 -0400 Subject: [PATCH] add register allocation problem --- docs/examples/polymorphism.mdx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 docs/examples/polymorphism.mdx diff --git a/docs/examples/polymorphism.mdx b/docs/examples/polymorphism.mdx new file mode 100644 index 0000000..479ddde --- /dev/null +++ b/docs/examples/polymorphism.mdx @@ -0,0 +1,30 @@ +--- +sidebar_position: 2 +--- + +import { Hidden } from "@site/src/components/Hidden"; + +# Polymorphism + +_By Kaz, July 2023 + +## Types + +What is the type of `f`? + +```sml +fun f ([],[]) = f ([],[]) ^ "A" + | f (_,_) = f (_,_) ^ "A" +``` + + + Type: ('a list * 'b list) -> string
+ + For a surprise, try putting the above function in the REPL! +
+ + + + + +