structure S = struct val x = 3; fun f(x) = if x=0 then 1 else x*f(x-1) end; - use "struct-simple"; [opening struct-simple] structure S : sig val f : int -> int val x : int end [closing struct-simple] val it = () : unit - x; Error: unbound variable x - f; Error: unbound variable f - S.x; val it = 3 : int - val x = 9; val x = 9 : int - S.x; val it = 3 : int - S.f S.x; val it = 6 : int - x; val it = 9 : int - open S; val x = 3 : int val f = fn : int -> int - x; val it = 3 : int - f x; val it = 6 : int