structure Stack = struct type 'a stack = 'a list ref fun create _ = ref [] fun push (st, x) = st := x::(!st) fun pop st = let val e = hd (!st) in (st := tl (!st); e) end end