/* define valid recursive types */ let /* define a list */ type intlist = {hd: int, tl: intlist} var lis:intlist := intlist {hd=1, tl=intlist{hd=2, tl=nil}} function printint(i: int) = let function f(i:int) = if i>0 then (f(i/10); print(chr(i-i/10*10+ord("0")))) in if i<0 then (print("-"); f(-i)) else if i>0 then f(i) else print("0") end in if (lis.tl <> nil) then printint(lis.tl.hd) else printint(lis.hd) end