1structure HM_SimpleBuffer :> HM_SimpleBuffer = 2struct 3 4fun mkBuffer () = let 5 val buf = ref ([] : string list) 6 fun push s = buf := s :: !buf 7 fun read () = let 8 val contents = String.concat (List.rev (!buf)) 9 in 10 buf := [contents]; 11 contents 12 end 13 fun reset() = buf := [] 14in 15 {push = push, read = read, reset = reset} 16end 17 18end (* struct *) 19